←  [EN] Enduser support

Forums

»

softcam startup script more universal

Pr2's Photo Pr2 13 Oct 2012

Hi,

Some people that want to use a more recent version of there softcam (oscam for exemple) find it sometimes hard to change the version.

I have then slightly rewrote the softcam startup script to have clearly separated softcam exe and parameters, so the startup script can become more universal for any softcam.

Can perhaps be a best pratice to use this new softcam startup script method for all the current available softcam in the repository.

Here is the script:


#!/bin/sh
# Define parameters here
# start-exe = executable to launch
# softcam_param = full command line parameters to pass to executable
# softcam_version = For information only, version of the executable
softcam_exe="/usr/bin/oscam-experimental"
softcam_param="-b -r 2 -c /etc/tuxbox/config/oscam-experimental"
softcam_version="1.20"

remove_tmp ()
{
 [ -e /tmp/ecm.info ] && rm -rf /tmp/ecm.info
 [ -e /tmp/.oscam ] && rm -rf /tmp/.oscam
 [ -e /tmp/.console ] && rm -rf /tmp/.console
 [ -e /tmp/camd.socket ] && rm -rf /tmp/camd.socket
 }

 case "$1" in
start)
exec start-stop-daemon -S -x $softcam_exe -- $softcam_param
;;
stop)
exec start-stop-daemon -K -R 2 -x $softcam_exe &
sleep 2
ps | grep $softcam_exe | grep -v grep > /dev/null
if [ $? -eq 0 ]
then
killall -9 $softcam_exe 2>/dev/null
fi
sleep 2
remove_tmp
;;
 restart|reload)
$0 stop
sleep 1
$0 start
;;
 version)
echo $softcam_version
;;
 info)
  echo "oscam"
  ;;
 values)
echo "Command line started:" 
echo $softcam_exe $softcam_param
;;
 *)
echo "Usage: $0 start|stop|restart|version|info|values"
exit 1
;;
 esac
 exit 0


Tested with different OScam version. I don't know if the info parameter is used somewhere in OpenPli so I leave it that way and add my own new options "values" that will display what the command line used to start the emu looks like.

Pr2
Quote

alsat1's Photo alsat1 13 Oct 2012

can you please give example for gbox?regards.
Quote

Pr2's Photo Pr2 13 Oct 2012

Hi,

It should be easy but I don't use gbox, so I have no idea what are the command line parameter to tell him where to look for the configuration file.

You place your gbox executable into for exemple /usr/bin don't forget to chmod 755.

You take the content of the script and create:

/etc/init.d/softcam.gbox
chmod 755 /etc/init.d/softcam.gbox

You place the values that you want into:
softcam_exe="/usr/bin/gbox"
softcam_param="The parameters that you need to pass to gbox"
softcam_version="just information you place the gbox version"

You go in the Openpli GUI and you select gbox and restart the softcam.

Pr2
P.S.: I just figure out that I should have create also softcam_info as variable. for the info) section so in your case replace oscam with gbox there.
I also wrote a wiki (in french sorry) on how to play with softcam on OpenPli image:
http://www.streamboa...x#Image_OpenPli
Quote

lateigne's Photo lateigne 20 Mar 2014

Hello,

How to modify this script to run 2 softcam?

Thanks

Quote

Pr2's Photo Pr2 22 Mar 2014

Duplicate all paramaters softcam_ for exemple softcam2_XXX and duplicate all lines in sript that refers to softcam_  and change all occurences of softcam_ by softcam2_ on those duplicated lines.

Quote

Pr2's Photo Pr2 30 Mar 2014

Hi,

 

Here is the full script to launch 2 softcams in the same startup script in Openpli.

 

#!/bin/sh
# Define parameters here
# softcam1_exe = executable to launch for 1st softcam
# softcam1_param = full command line parameters to pass to executable 1st softcam
# softcam2_exe = executable to launch for 2nd softcam
# softcam2_param = full command line parameters to pass to executable 2nd softcam
softcam1_exe="/usr/bin/oscam"
softcam1_param="-b -r 2 -c /etc/tuxbox/config/oscam"
 
softcam2_exe="/usr/bin/OSEmu"
softcam2_param="-a user:password -p 12000 -b"
 
softcam_info="OScam and OSemu"
 
 
remove_tmp ()
{
 [ -e /tmp/ecm.info ] && rm -rf /tmp/ecm.info
 [ -e /tmp/.oscam ] && rm -rf /tmp/.oscam
 [ -e /tmp/.console ] && rm -rf /tmp/.console
 [ -e /tmp/camd.socket ] && rm -rf /tmp/camd.socket
 }
 
 
 case "$1" in
start)
start-stop-daemon -S -x $softcam1_exe -- $softcam1_param
start-stop-daemon -S -x $softcam2_exe -- $softcam2_param
;;
stop)
start-stop-daemon -K -R 2 -x $softcam1_exe
start-stop-daemon -K -R 2 -x $softcam2_exe
sleep 3
ps | grep $softcam1_exe | grep -v grep > /dev/null
if [ $? -eq 0 ]
then
killall -9 $softcam1_exe 2>/dev/null
fi
ps | grep $softcam2_exe | grep -v grep > /dev/null
if [ $? -eq 0 ]
then
killall -9 $softcam2_exe 2>/dev/null
fi
sleep 2
remove_tmp
;;
 restart|reload)
$0 stop
sleep 2
$0 start
;;
 version)
$softcam1_exe -V | head -n 1 | awk '{print $2}'
;;
 info)
  echo $softcam_info
  ;;
 values)
echo "Command line started:" 
echo $softcam1_exe $softcam1_param
echo $softcam2_exe $softcam2_param
;;
 *)
echo "Usage: $0 start|stop|restart|version|info|values"
exit 1
;;
esac
exit 0

 

Enjoy!

Quote

MiLo's Photo MiLo 30 Mar 2014

Replace:
<command>
if $? -eq 0 ; then
with
if <command> ; then
Instead of
grep ... > /dev/null
Simply use
grep -q ...

Edited by MiLo, 30 March 2014 - 18:41.
Quote

lateigne's Photo lateigne 30 Mar 2014

Hi pr2 and Milo,

thanks for the answer.

 

Merci!

Quote

balkanac's Photo balkanac 21 Sep 2014

Hello....

Do you somebody have script for unicam emu?

If you have, please, put in this place, or send me on PM.

I have DM 800HD SE Ferrari card, and OpenPLI 2.1

Thanks!!!


Edited by balkanac, 21 September 2014 - 14:48.
Quote

hemertje's Photo hemertje 21 Sep 2014

we do not support Ferrari Card clone boxes or do we build images for it

Quote

balkanac's Photo balkanac 21 Sep 2014

@hemertje

 

I have two Dreamboxes, other is original 800HD SE. If you have script for unicam, please, give me on PM, or this page.

Thanks!!

Quote

sportfootbol's Photo sportfootbol 21 Sep 2014

Unicam emu is unique for all versions openpli....Only if someone wants to set up a script for this very good emu...Thanks...

Quote

MiLo's Photo MiLo 22 Sep 2014

Just install the "custom" softcam, and edit the script.

Quote

sportfootbol's Photo sportfootbol 22 Sep 2014

unicam.sh.....

#!/bin/sh

OSD="unicam"
PID=`pidof unicam`
Action=$1

cam_clean () {
        rm -rf /tmp/*.info*    /tmp/*.tmp*
}

cam_handle () {
        if test    -z "${PID}"    ; then
                cam_up;
        else
                cam_down;
        fi;
}

cam_down ()    {
        killall    unicam
        sleep 2
        cam_clean
}

cam_up () {
        /usr/bin/cam/unicam -c /etc/tuxbox/config &
}

if test    "$Action" =    "cam_res" ;    then
        cam_down
        cam_up
elif test "$Action"    = "cam_down" ; then
        cam_down
elif test "$Action"    = "cam_up" ; then
        cam_up
else
        cam_handle
fi

exit 0

 

Please what would a script for openpli ...

Quote

Pr2's Photo Pr2 22 Sep 2014

Take my first script and replace those 2 lines:

 

softcam_exe="/usr/bin/oscam-experimental"
softcam_param="-b -r 2 -c /etc/tuxbox/config/oscam-experimental"

 

By:

 

softcam_exe="/usr/bin/cam/unicam"

softcam_param="-c /etc/tuxbox/config"

 

That's all you need to change.

 

Pr2

 

Quote

sportfootbol's Photo sportfootbol 22 Sep 2014

Sorry ,not work ...OpenPli 2.1 image


Edited by sportfootbol, 22 September 2014 - 20:01.
Quote

balkanac's Photo balkanac 22 Sep 2014

I confirm, don`t work with OpenPLi 2.1

Any other solutions?

Quote

sportfootbol's Photo sportfootbol 28 Sep 2014

has anyone tried to make a script for this extra fast emu.....Thanks...

Quote

kaligola's Photo kaligola 14 May 2015

need me too script for unicam, is it 

 

Take my first script and replace those 2 lines:

 

softcam_exe="/usr/bin/oscam-experimental"
softcam_param="-b -r 2 -c /etc/tuxbox/config/oscam-experimental"

 

By:

 

softcam_exe="/usr/bin/cam/unicam"

softcam_param="-c /etc/tuxbox/config"

 

That's all you need to change.

 

Pr2

need to make script for  start/stop  unicam ,

Quote

Pr2's Photo Pr2 14 May 2015

The script is universal simply change the two mentionned parameters.
Quote