Oscam restart script

There are 7 replies in this Thread which was already clicked 3,553 times. The last Post () by hs5424.

  • I moved from older post location.

    I want to check if my ubuntu server has a check in place to restart oscam every 5 mins or so should things go wrong. The shell script is present in the var/script location ok, however I am confused as I don't have a single crontab file. I have hourly, daily, weekly and monthly crontab folders in etc/. In the hourly folder there is an empty file called .placeholder. Do I need to rename this and insert */5 * * * * root /var/script/OscamCheck.sh


    Any help appreciated.

  • Thanks zilizila,

    Followed your advise and now have new file called oscam_checker placed in cron.d with the following contents */5 * * * * root /var/script/OscamCheck.sh

    I suppose if I send a command to stop oscam for testing it should restart in 5 mins if I am correct.


    Thanks again.

  • Hi.


    This is not a clean answer from zilizila. Namely, on each Linux (you mentioned Ubuntu) a different CRON can be used. There are several, and each has a different init.d script in the /etc/inid.d folder, so restarting CRON may be a little different. But maybe what I wrote above works for you to restart the CRON service, after the CRON changes.


    As for Oscam, why do you want to restart ? Don't you need to find out first if Oscam is alive or if Oscam needs a new entitlements ? Each satellite provider behaves differently. Each firmware in the decoder card behaves differently. Also, each coding system behaves differently.


    So, the right question for you is: Why do you need to restart Oscam every 5 minutes ?


    This allows you to stop watching TV for a few seconds (every 5 minutes repeatedly). Doesn't that interfere ? Or is there a coding system used that doesn't hinder it ? Or do you use a shell script in which everything is clear and in which the activity of your Oscam is detected ?


    As for the file in the "/etc/cron.d/" folder, these files inside, have a special purpose. You have to study / find it on the internet yourself. Colleague above probably forgot to mention this fact to you. In this case, you do not have to insert another configuration line into the basic configuration file for the CRON service. This line will already be in the mentioned file "/etc/cron.d/<something>".


    For example, some info from the source: https://opensource.com/article/17/11/how-use-cron-linux

    cron.d

    The directory /etc/cron.d is where some applications, such as SpamAssassin and sysstat, install cron files. Because there is no spamassassin or sysstat user, these programs need a place to locate cron files, so they are placed in /etc/cron.d.

    The /etc/cron.d/sysstat file below contains cron jobs that relate to system activity reporting (SAR). These cron files have the same format as a user cron file.

    Code
    # Run system activity accounting tool every 10 minutes
    */10 * * * * root /usr/lib64/sa/sa1 1 1
    # Generate a daily summary of process accounting at 23:53
    53 23 * * * root /usr/lib64/sa/sa2 -A

    The sysstat package installs the /etc/cron.d/sysstat cron file to run programs for SAR.

    The sysstat cron file has two lines that perform tasks. The first line runs the sa1 program every 10 minutes to collect data stored in special binary files in the /var/log/sa directory. Then, every night at 23:53, the sa2 program runs to create a daily summary.

  • Oh, then OK, but you don't have to write the whole script (file) at all. Just paste it as a command directly into the cron config file.


    It just depends on what basis you want to test the Oscam process. I don't know what works on Ubuntu. Maybe it would be enough to use "pidof". I have already written a large number of similar "commnad-line". It depends on the specific Linux and the type of Softcam startup.


    Example:

    * * * * *        if ! pidof oscam > /dev/null; then /etc/init.d/softcam restart; fi


    Or this one:

    * * * * *        if ! pidof oscam > /dev/null; then killall -9 oscam; /usr/bin/oscam -b -r 2; fi


    Instead of "pidof" it is possible to use "ps" which is much more complex, or other tools to control processes. This is because a process can be started... but frozen... and "pidof" will always return process numbers (even if they are frozen). The "ps" tool is then better for this purpose.


    Or change the way Oscam's functionality is tested. For example, it is possible to open Oscam-Webif every minute (but you must also enter the password in the URL here) and if Oscam-Webif does not open, it means that Oscam has frozen.


    ///// EDIT :


    I wrote some extra examples.

    Some of that might work on your Ubuntu Linux :).

    Take a look at other examples of Oscam functionality and its conditional restart:


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!