I am using this check script to see if a package called CCcam is running & restart it if it is not..
#!/bin/sh
process=`ps auxwww | grep CCcam | grep -v grep | awk '{print $1}'`
if [ -z "$process" ]; then
echo "Couldn't find CCcam running. Restarting server-binary" >> /var/cccamlog/cccam.check
echo && date >>/var/cccamlog/cccam.check
/usr/local/bin/CCcam -d >> /var/cccamlog/CCcam.log &
else echo "CCcam is still OK!" >> /var/cccamlog/cccam.check
fi
The script is reporting "CCcam is still OK!"
But it is not running, If i search for the process using this command:
ps x |grep -v grep |grep -c CCcam
, I get 0 so I know the process is not running.
Is there any other factors that I should take into account that might be fooling the check script into thinking CCcam is running? For example, could there be some kind of tag left after the program crashes/stops that the script is picking up on?
From another test I get.. ERROR: CCcam still runs with pid: