How to "Oscam check script"

There are 42 replies in this Thread which was already clicked 33,918 times. The last Post () by kiko2004.

  • Remarks, HERE;
    1. if you activate remove-tmp--you will not see the feedback of script -- on /var/log/oscam.check---because all the time when the oscam_rs is running, will remove the logs
    But the process is running, and you can verify in var/log /messages from Kernel
    2. you can delete remove_tmp from script if you want feedback in /var/log/oscam_restart_log.check



    #!/bin/sh
    remove_tmp () {
    rm -rf /tmp/*.info* /tmp/*.tmp*
    }
    oscam_rs () {
    killall -9 oscam_r5893 >/dev/null
    sleep 6
    remove_tmp
    sleep 3
    /usr/bin/oscam_r5893
    }


    if ! ps x | grep -v grep | grep -c /usr/bin/oscam_5893 >/dev/null
    #or if ! ps x | grep -v grep | grep -c oscam_r5893 >/dev/null
    then
    oscam_rs
    echo `date "+%d/%m/%y %R process was not working"` >> /var/log/oscam_restart_log.check # or oscam.check
    elif
    tail -8 /var/log/oscam.log |grep -v grep |grep -c ins40 >/dev/null
    then
    oscam_rs
    echo `date "+%d/%m/%y %R ins40 error detected"` >> /var/log/oscam_restart_log.check
    elif
    tail -8 /var/log/oscam.log |grep -v grep |grep -c deadlock >/dev/null
    then
    oscam_rs
    echo `date "+%d/%m/%y %R deadlock error detected"` >> /var/log/oscam_restart_log.check
    else
    echo "ok"
    fi


    #############################
    if you want feedback in var/log , script will be,...like this
    also you can put a stick, in USB and sent the oscam.check file-- there
    ====================
    /var/log/oscam.log---------/media/usb/oscam.log ..........this is the simplest way.
    /var/log/oscam.check---------/media/usb/oscam.check
    myself I moved all .log and .check files in stick -- /media/usb/
    or you can copy and afte delete,...
    cp :/var/log/ *.* /media/usb
    and after
    del :/var/log/*.*


    ################################################################################


    oscam_rs () {
    killall -9 oscam_r5893 >/dev/null
    #killall -9 oscam_r5893
    sleep 6
    /usr/bin/oscam_r5893
    }


    if ! ps x | grep -v grep | grep -c /usr/bin/oscam_5893 >/dev/null
    #or if ! ps x | grep -v grep | grep -c oscam_r5893 >/dev/null
    then
    oscam_rs
    echo `date "+%d/%m/%y %R process was not working"` >> /var/log/oscam_restart_log.check # or oscam.check
    elif
    tail -8 /var/log/oscam.log |grep -v grep |grep -c ins40 >/dev/null
    then
    oscam_rs
    echo `date "+%d/%m/%y %R ins40 error detected"` >> /var/log/oscam_restart_log.check
    elif
    tail -8 /var/log/oscam.log |grep -v grep |grep -c deadlock >/dev/null
    then
    oscam_rs
    echo `date "+%d/%m/%y %R deadlock error detected"` >> /var/log/oscam_restart_log.check
    else
    echo "ok"
    fi


    bye


  • I was playing around with this idea and a simpler way might simply be to watch your WebInterface. Can I maybe suggest inclusion of the following


    Code
    elif
    ! curl -s -digest -o -u <user>:<password> "http://192.168.1.2:8888" |grep -c "Access denied." >/dev/null
    then
    /usr/bin/killall -9 oscam
    /var/local/oscam -b &
    echo `date "+%d/%m/%y %R Web Interface NOT working, restarting...."` >> /var/log/oscam/oscam_check.log


    There is a way to run the curl properly and get the full webpage but in this instance, it works out simpler by it not working and you will only get an "Access denied." prompt if the WebInterface is still running.

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!