Question : Script to check if specific background processes are running, if not start them

I have a few background processes that occasionally die.. what I'm trying to do is make  a script that will check to see if any one of the 3 are dead & start the appropriate one - this way i can crontab it and be done with it, right now i'm logging in to check every so often

Answer : Script to check if specific background processes are running, if not start them

try this script

for proc in process1 process2 process3
do
   c=`/usr/bin/ps -ef | /usr/bin/grep $proc | /usr/bin/grep -v grep | /usr/bin/wc -l`
   if [ $c -eq 0 ]
   then
          /path/to/$proc.start
   fi
done

Here process1, process2, process3 are processes names

you need startup scripts for processes e.g. /path/to/process1.start where you put actual startup commands. these should be full path names to commands
Random Solutions  
 
programming4us programming4us