here you go bob....
thanks to OP
This is a script i put together a while back to check if cccam is up and running on my DM500s using pli jade.
Use: If cccam is running nothing is done, if cccam is unresponsive it is restarted.
How to implement:
Telnet to your dreambox ip , i use Putty as my connection manager on Windows as its free and does the job perfectly.
Once you log into your dreambox ,decide where you want to place the script. I put it in /var/bin/
Insert the below code into the file CCcamCheck.sh
I chose to use the VI text editor in the above example but the file can be ftpd to your chosen directory.
Make sure the above code is changed to meet your needs.
Once the file is in place
To make the file executable.
At this point you should be able to test the script by issuing the following.
which should output the following
If the output is ok. You will have to add the job to root crontab. So the check is run every X min.
First off i had to start the cron deamon. In pli jade i did this by doing the following:
and it should display the following.
PID 19056 is the ps aux | grep -i cron process id which can be ignored.
Now that crond is running.
We have to create a file called root in:
and insert the following.
This runs the script every one min
thanks to OP
This is a script i put together a while back to check if cccam is up and running on my DM500s using pli jade.
Use: If cccam is running nothing is done, if cccam is unresponsive it is restarted.
How to implement:
Telnet to your dreambox ip , i use Putty as my connection manager on Windows as its free and does the job perfectly.
Once you log into your dreambox ,decide where you want to place the script. I put it in /var/bin/
Code:
cd /var/bin/
vi CCcamCheck.sh
Code:
#!/bin/sh
USERNAME=root
PASS=whatever
HOST=192.168.1.2
PORT=16001
if
ps x |grep -v grep |grep -c CCcam >/dev/null ; then
if
cd /tmp/
wget http://$USER:$PASS@$HOST:$PORT ; then
rm /tmp/index.html
echo "$(date) wget ok .... CCcam is up and running"
else
echo "wget not ok trying to kill CCcam"
if killall CCcam > /dev/null ; then
echo "$(date) CCcam Killed"
else
if /bin/CCcam > /dev/null ; then
sleep 10;
echo "$(date) Cccam Restarted"
if ps x |grep -v grep |grep -c CCcam >/dev/null ; then
if
cd /tmp/
wget http://$USER:$PASS@$HOST:$PORT ; then
rm /tmp/index.html
echo "$(date) wget ok .... CCcam is up and running"
fi
fi
fi
fi
fi
fi
Make sure the above code is changed to meet your needs.
Once the file is in place
Code:
chmod +x CCcamCheck.sh
To make the file executable.
At this point you should be able to test the script by issuing the following.
Code:
/var/bin/CCcamCheck.sh
If not open up the script and try to debug.Connecting to 192.168.1.2[192.168.1.2]:16001
index.html 100% |************************************************* ************************************************** *******| 972 --:-- ETA
Fri Feb 19 16:45:58 CET 2010 wget ok .... CCcam is up and running
If the output is ok. You will have to add the job to root crontab. So the check is run every X min.
First off i had to start the cron deamon. In pli jade i did this by doing the following:
To check if crond has started use this command.Blue button > System Settings > Services to run > <Ticked> Start Crond and Saved
Code:
ps aux | grep -i cron
PID 80 is the crond process which confirms it is up and running.root@dm500 /var/bin # ps aux | grep -i cron
80 root 636 S crond
19056 root 440 S grep -i cron
PID 19056 is the ps aux | grep -i cron process id which can be ignored.
Now that crond is running.
We have to create a file called root in:
Code:
vi /var/spool/cron/crontabs/root
Code:
*/1 * * * * /var/bin/CCcamCheck.sh >> /tmp/CCcamCheck.log 2>&1
The script to be run is*/1 * * * *
And a log file is created in/var/bin/CCcamCheck.sh
/tmp/CCcamCheck.log
That should be it.
Once everything is in place, this script should work fine "To my knowledge"
You can always check what is happening by tailing the log file
Code:tail -f /tmp/CCcamCheck.log
Last edited: