Script to restart 1 of 2 readers on no entitelments.

There are 10 replies in this Thread which was already clicked 5,595 times. The last Post () by s3n0.

  • Hello All.


    I need a script that restarts a internal reader on no entitlements. I need this because one of my readers needs to be restarted a couple of times after restart of oscam, to read the entitlements. The other reader works without any problems (both are internal), so i do not want to restart oscam, but only the reader that does not work.
    Is this even possible? If yes, can anyone give me a push in the right direction, to where i can read about it, and try to make the script. I have tried to search high and low, but I do not seem to find anything on reader restart, only oscam restart.


    Thanks in advance

  • I do not think it can restart a single reader without restarting oscam


    "... one of my readers needs to be restarted a couple of times after restart of oscam, to read the entitlements" - can you explain more

    together we grow - ferdi

  • I believe it can, if i go the webif way. My thought was somthing like this:

  • I finally succeeded! If anyone else should be interested this is how:


    Webif must be activated in oscam.confand running.


    install curl via opkg with: opkg install curl


    Copy this script into /usr/script/, and set your box to run the script as offen as you like.


    #!/bin/sh
    while [ $(curl --digest -u'user:pass" "http://127.0.0.1:port/entitlements.html?label=Upper" | grep -c "tier") -lt 2 ]
    do
    curl --digest -u"user:pass" "http://127.0.0.1:port/status.html?action=restart&label=reader"
    sleep 65
    done
    echo "reader ok"


    Where user, pass and port is as configured in oscam.conf.
    Reader can be either upper or lower.
    Remember to grant access to 127.0.0.1 in oscam.conf

    Edited once, last by apebk ().

  • wafi villa :


    Instead of repeating the post, you'd better write what exactly doesn't work for you.


    /// EDIT :


    Improved previous script, no need to use curl (only wget will be used):



    Of course, this shell-script is not necessary at all if you use CRON - system scheduler. Just add a configuration line to CRON config-file:


    * * * * *       if [ $(/usr/bin/wget -qO- "http://USER:PASS@127.0.0.1:PORT/entitlements.html?label=YOUR_READER_LABEL" | grep -c "tier") -gt 0 ]; then /usr/bin/wget -qO- "http://USER:PASS@127.0.0.1:PORT/status.html?action=restart&label=YOUR_READER_LABEL" > /dev/null 2>&1; fi


    Don't forget to fill (to replace) the USER, PASS and PORT values for your Oscam-Webif !


    Or here is another example, a ready-made shell script that runs in the background and can run automatically with the set-top box via the init.d system in RunLevel3 (applies to Enigma2 set-top boxes):

    e2scripts/oscamrr at master · s3n0/e2scripts
    some helpful scripts (Python or Shell) for Enigma2 - e2scripts/oscamrr at master · s3n0/e2scripts
    github.com

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!