ProcessChk
From FrogspawnWiki
If you have a process on a Linux box that must be running, but is prone to crashing then you need this script to check and restart it.
All it requires is a pid file
pidfile=~/process.pid if [ -e $pidfile ] then pspid=$(cat $pidfile) if `kill -CHLD $pspid >/dev/null 2>&1` then exit 0 else echo process on PID $pspid dead. Restarting... ./start_daemon fi else echo PID file $pidfile does not exist fi
I use this myself to keep a daemon running, it does the job.