Some more OScam and CCcam monitoring scripts
This script is not tested by me, but apperantly it works just fine!
#!/bin/sh #Scriptfile for starting and stopping oscam #Scriptwriting done by CC_Share #For support and more info visit http://www.eurocardsharing.com
#Setting variables CAMNAME="Oscam Server" CAMDIR="/emu/oscam" CONFDIR="/usr/local/etc" LOGDIR="/var/log/oscam/log" CAM="oscam.x86" # end
# Checking for pid file existance if [ ! -f $CAMDIR/oscam.pid ] then echo "No pidfile exists, Creating PID for oscam" else rm $CAMDIR/oscam.pid echo "Pidfile allready found, Removing old pidfile" fi
pidof $CAM > $CAMDIR/oscam.pid PID=$(exec cat $CAMDIR/oscam.pid)
# This method starts oscam start_cam () { $CAMDIR/$CAM -b -c $CONFDIR & sleep 5 } # This method stops oscam stop_cam () { kill -9 $PID sleep 5 } case "$1" in start) echo "[SCRIPT] $1: $CAMNAME" ##Check if cam is runing if ps | grep -v grep | grep -v start | grep $CAM > /dev/null then echo "$CAM runing, stop it first!" else start_cam fi ;; stop) echo "[SCRIPT] $1: $CAMNAME" stop_cam ;; restart) echo "Restarting $CAMNAME" stop_cam start_cam ;; *) "$0" stop exit 1 ;; esac exit 0 NEW SCRIPT NEW SCRIPT NEW SCRIPT NEW SCRIPT NEW SCRIPT #!/bin/sh #Scriptfile for starting and stopping CCcam #Script has been modified to enable both x86 and x86_64 versions #Scriptwriting done by CC_Share #For support and more info visit http://www.eurocardsharing.com #Setting variables CAMNAME="CCcam Server" CAMDIR="/emu/cccam" LOGDIR="/emu/log" # end # Checking what CCcam version is used on this computer. if [ ! -f $CAMDIR/CCcam.x86_64 ] then CAM="CCcam.x86" else CAM="CCcam.x86_64" fi # Checking for pid file existance if [ ! -f $CAMDIR/cccam.pid ] then echo "No pidfile exists, Creating PID for CCcam" else rm $CAMDIR/cccam.pid echo "Pidfile allready found, Removing old pidfile" fi pidof $CAM > $CAMDIR/cccam.pid PID=$(exec cat $CAMDIR/cccam.pid) # This method starts CCcam start_cam () { $CAMDIR/$CAM -dv >> /$LOGDIR/debug.txt & sleep 5 } # This method stops CCcam stop_cam () { kill -9 $PID sleep 5 } case "$1" in start) echo "[SCRIPT] $1: $CAMNAME" start_cam ;; stop) echo "[SCRIPT] $1: $CAMNAME" stop_cam ;; restart) echo "Restarting $CAMNAME" stop_cam start_cam ;; *) "$0" stop exit 1 ;; esac exit 0
Oscam Check Scripts
In this article i will present you OScam check script that i use and works without any problems. I use it on Ubuntu but it was 100% reliable on Fedora too. Script simply checks if process oscam is still present in your system. If not, script restarts your OScam. Make sure that your OScam executable is named “oscam”. It also needs to have 755 permissions! I hope that this copy/pasted script works OK. If not, please leave a comment!
#!/bin/sh # FOO="/tmp/_tmp" LOGIN="root" PW="dreambox" IP="192.168.1.155" PORT="16002" STR="TITLE>" # curl -s --digest -o - -u $LOGIN:$PW "http://$IP:$PORT/status.html?hideidle=0" | grep "$STR" > $FOO printf "Checking for ERRORS ...\n"; if [ -s $FOO ]; then printf "\033[37;32mOscam working OK\033[37;40m\n"; else printf "\033[37;31mOscam ERROR!\033[37;40m\n"; /usr/local/bin/oscam -b > /dev/null fi rm -f $FOO exit 0