PDA

View Full Version : OSCAM Script required



choakem
28th April, 2012, 04:21 PM
Hi guys hopefully you can help...

I have a script that checks to see if OSCAM is running and restarts if required - this works fine.

Every now and again OSCAM will detect no card in my smargo card reader but continues to run normally and this is not detected by my current script. If I browse to http://server-ip:8888/graph.svg?type=servers then my card is detected as IDLE.

Is there a script to detect this IDLE state and restart OSCAM?

Any advice or help would be appreciated.

Here is my current oscam-check script.

!/bin/sh
process=`ps auxwww | grep oscam | grep -v grep | awk '{print $1}'`
if [ -z "$process" ]; then
echo "Couldn't find Oscam running. Restarting server-binary" >> /var/cccamlog/o$
echo && date >>/var/cccamlog/oscam.check
/usr/local/bin/oscam >> /var/cccamlog/Oscam.log &
else echo "Oscam_1.00 is still OK!" >> /var/cccamlog/oscam.check
fi

davvo
29th April, 2012, 08:52 AM
this is for dream elite phoenix edition
the script runs another script then oscam starts
it works perfect

edit the parts in yellow to suit your image



#!/bin/sh
#Script to check if OSCAM is running.
process=`ps auxwww | grep oscam | grep -v grep | awk '{print $1}'`
if [ -z "$process" ]; then
echo "Couldn't find OSCAM running Restarting OSCAM Server" >> /var/log/oscam.check
echo && date >> /var/log/oscam.check
else
/usr/camscript/Ncam_oscam.sh start
echo "OSCAM is still OK!" >> /var/log/oscam.check
fi

choakem
29th July, 2012, 06:40 PM
This script works only if OSCAM has stopped working - My issues were more along that the script was working fine but my card remained idle and all ECM requests were denied.
I went through the logs and found the following:-

"rejected group (0 ms) (of 0 avail 0) (no matching reader)"

I created a script called ServerOK.sh
if tail -8 /var/log/oscam.log |grep -v grep |grep -c matching>/dev/null
then
echo restart server
/sbin/shutdown now -r
else
echo running ok
fi

It fairly basic but I added this to my crontab to run every 5 mins. Seems to work fine. Every time my card seems to stop answering ECM request then I reboot the server. Happens once every couple of days. I could have just restarted OSCAM I suppose but thats easy to change.

hopefully this mayhelp others that encountered this problem with OSCAM.

It simply checke my oscam log file for the word "matching" which seems to be a unique word for my issues in the log file.

So far it been up for a week and no issues have been encountered.

Manic01
30th July, 2012, 04:43 PM
Took a while to reply lol
At elast it seems ok now.
Well done.

ITS A SCAM !
21st July, 2014, 06:55 AM
Sorry to dig up this old thread, does anyone know if this will work on a raspberry Pi running oscam ??