I have written a short sh script to check if a process is running and
start it if it isn't. The process looks for a file (which may or may not
exist) that contains the pid, checks to see if the process is running:
if [ -f $pidfile ]; then
$pid=`cat $pidfile`
$check=`ps x | grep "^ *$pid"`
if [ -z "$check" ]; then
$progname > /dev/null 2>&1
fi
else
$progname > /dev/null 2>&1
fi
This works great from the command line, but fails if I put it in the
crontab, and cron doesnt mail me anything. The system is NetBSD. Any
suggestions?
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=