linux - Script to check for process & restart program if not found -


this question has answer here:

i using check script see if package called cccam running & restart if not..

#!/bin/sh  process=`ps auxwww | grep cccam | grep -v grep | awk '{print $1}'` if [ -z "$process" ]; 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 still ok!" >> /var/cccamlog/cccam.check  fi  

the script reporting "cccam still ok!"

but not running, if search process using command: ps x |grep -v grep |grep -c cccam, 0 know process not running.

is there other factors should take account might fooling check script thinking cccam running? example, there kind of tag left after program crashes/stops script picking on?

from test get.. error: cccam still runs pid:

if pidof -s cccam > /dev/null;     echo 'it running!' else     echo 'process not found...' fi 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -