This is a script for monitoring :
1. If Oscam process running
2. If warnings were found in Oscam log
3. If panics were found in Oscam log
Shortly a full monitor script.
In oscam config is mandatory to activate logfile option
oscam-check.sh v0.1
Just change the variables at the beggining and should work just fine, put this in crontab to run every minute.
If you have further questions just post them here
1. If Oscam process running
2. If warnings were found in Oscam log
3. If panics were found in Oscam log
Shortly a full monitor script.
In oscam config is mandatory to activate logfile option
oscam-check.sh v0.1
Code:
#!/bin/bash oscamlog="/var/oscam/oscam.log" logfile="/var/oscam/oscam-check.log" oscampath="/var/oscam/oscam" oscamstart_cmd="/var/oscam/oscam -b -c /var/oscam" warning_limit="1" panic_limit="1" if [ $(ps -A | grep -c oscam) = 0 ]; then echo "$(date) Starting Oscam" >> $logfile $oscamstart_cmd fi if [ $(grep -c WARNING $oscamlog) -gt $warning_limit ]; then echo "$(date) Warning Detected - Stoping Oscam" >> $logfile grep -c WARNING $oscamlog >> $logfile killall -9 oscam cp $oscamlog $oscamlog".failed" cat /dev/null > $oscamlog sleep 2 echo "$(date) Oscam started after WARNING" >> $logfile $oscamstart_cmd fi if [ $(grep -c PANIC $oscamlog) -gt $panic_limit ]; then echo "$(date) PANIC Detected - Stoping Oscam " >> $logfile grep -c PANIC $oscamlog >> $logfile killall -9 oscam cp $oscamlog $oscamlog".failed" cat /dev/null > $oscamlog sleep 2 echo "$(date) Oscam started after PANIC" >> $logfile $oscamstart_cmd fi
If you have further questions just post them here
Comment