Linux Script to Autostart a Background Process if not running

Linux Script to Autostart a Background Process if not running

# start a background process if it is not running, can also use in cron to check every hour or so
#!/bin/sh
   if ! ps -elf | grep -v grep | grep processname ; then
   python processname.py >> /home/user/bin/spooler.log & 
##        #mailing program
##        /home/user/bin/simplemail.php "Print spooler was not running...  Restarted." 
fi
Comments are closed.