SCRIPT TO AUTO START OSCAM WHEN IT STOPS AND HOW TO RUN CRONJOB ON ENIGMA 2

There are 15 replies in this Thread which was already clicked 25,703 times. The last Post () by s3n0.

  • SCRIPT TO AUTOSTART OSCAM WHEN IT STOPS AND HOW TO RUN CRONJOB ON ENIGMA 2

    Oscam and CCcam which are client emu, could sometimes stop working or crash and therefore your Cline or Nline will go off, and you would have to restart the box or from panel.

    However, with a script, and cronjob……Oscam/CCcam will be monitored and when it goes off, cron will restart it immediately. This is how to;

    The script contains commands that check if CCcam/Oscam is running and if it isn’t it will restart it whereas cronjob tells at what frequency should the script check on Oscam/CCcam. So cronjob can say every 1 minute check if CCcam/Oscam is running if not restart it.

    Here is the script;


    Bash
    #!/bin/bash
    if ! ps -C oscam > /dev/null
    then /usr/bin/oscam -b
    fi


    /usr/bin/ is the location of your bin fine, very very important

    I have named it oscamcheck.sh and placed in /usr/script/ chmod 755

    Now install cron manager, if not already with the image, you can go to pluginsdownload / extensions and cronmanager, download and install the latest version.



    Now you would have to check if cron is installed and really running

    telnet to your box and type;

    Code
     /etc/init.d/busybox-cron start

    f61857c6acfb66b2c931fecc.jpg

    Now we have confirmed cronmanager is working, so let’s stop it

    Code
    /etc/init.d/busybox-cron stop

    Now we need to create the root file chmod 755

    The root file is found in /etc/cron/crontabs/root if the file is already there, then you have to edit, if not create one with a Unix editor like notepad++

    Put this line in root

    Code
    */1 * * * * /usr/script/oscamcheck.sh

    The line will check every minute if Oscam is running if not the script will restart Oscam.

    Now you can check if the script is really working

    Type

    Code
    killall -9 oscam

    And oscam will stop working and your line will freeze

    Now restart the script from telnet and occam will start working again

    Code
    cd /usr/script/
    ./oscamcheck.sh

    And oscam starts working again…….

    Let’s finally put these last commands and let cronmanager start his work

    Code
    update-rc.d busybox-cron defaults
    Code
    /etc/init.d/busybox-cron start &

    d34155b728873.jpg

    Now everything will be working very fine

    And your oscam will never ever sleep

    Enjoy sweetness


  • Hi Friend


    I have did what you have said above and nothing is going wrong


    But, every time that I turn receiver off and on again, I have to go to script panel (by pressing Green and then Blue Button) and press OK on oscamcheck to start the oscam.


    Is it normal or I did something wrong???


    Please guide me.

  • with me not work, with image pure2, evry time i restart or reboot the box i have to activate de oscam on the cam maneger. : (

  • lamm:


    What exactly does not work ? Some is wrong. PurE2 image ? Uhm... here is HowTo: https://www.vuplus4k.com/tutor…o-install-oscam-on-pure2/ You can simple install a Oscam. Then replace the oscam binary with the new one. But do not forget to verify or set the execution rights for oscam binary file (for example: "chmod +x /usr/bin/oscam").


    There's also a way to leave the PurCamd manager and install Oscam by yourself :). I do not know PureE2 and I do not know exactly how Softcam starts there. Maybe via "/etc/init.d/softcam" (oscam) bash script ? You can also read this: Does the location of Oscam's config files depend on the image/hardware being used? (download the archive from this post and read the "intro" text file ... I notice however that the procedures are focused on OpenPLi and OpenATV images)

    Edited 4 times, last by s3n0 ().

  • BTW, this procedure and this bash script are not reliable !

    On some Enigma2 editions, CRON controls are different !


    For example, in the case of OpenATV image, CRON is already installed by default and controlled by the following script:

    /etc/init.d/crond {start|stop|restart}


    Or another example, in the case of OpenPLi, CRON is not a default installed service. You must first install the service: "opkg update && opkg install busybox-cron". In OpenPLi, CRON is controlled by the following script:

    /etc/init.d/busybox-cron {start|stop|restart|reload}


    In both cases, the CRON configuration file is located here:

    /etc/cron/crontabs/root


    So, first you stop the CRON service because of possible system instability. Then you modify the CRON configuration file and finally start the CRON service again.


    As far as the configuration line in the CRON file is concerned, it is not necessary to run another bash-script at all !


    Only a one-line command for restarting your Softcam (Oscam) can be written directly into the CRON configuration file, such as:

    0 3 * * * killall -9 oscam; sleep 1; /usr/bin/oscam -b -r 2 -c /etc/tuxbox/config

    ...or better through the softcam control bash-script:

    0 3 * * * sh /etc/init.d/softcam restart


    ...or the issue related to this discussion thread:

    * * * * * if ! ps -C oscam > /dev/null; then sh /etc/init.d/softcam restart; fi

    ...or the second solution:

    * * * * * if ! ps -C oscam > /dev/null; then killall -9 oscam; sleep 1; /usr/bin/oscam -b -r 2 -c /etc/tuxbox/config; fi


  • Or another example, in the case of OpenPLi, CRON is not a default installed service. You must first install the service: "opkg update && opkg install busybox-crontab

    Hi,please change to opkg install busybox-cron in OpenPli

  • Hi.


    After installing any softcam in Enigma2, you still need to activate this softcam in the GUI MENU (using RCU). Then your chosen softcam will start automatically. OpenPLi includes its own IPK installers on the feed server, which are designed for this way of running softcams. Starting shell-scripts for softcams in this case, can be found here:

    /etc/init.d/softcam.<softcam-name> {start|stop|restart}

    This method also uses OpenATV and several other Enigma2 distributions.


    Well, since you have already solved it, then everything is fine :).

  • master G

    Set the Label from OSCam Scripts to Scripts OSCam

OSCam Support Forum

Configs, discussion, downloads and guides for OSCam Softcam.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!