crontab -e
Gave this to Rogue a little earlier tonight. You could use this also
#!/bin/bash
# checkprocess.sh
PROCESS=
check_running_process()
{
sudo ps -ef | grep -v grep | grep $PROCESS > /dev/null
result=$?
#echo "exit code: ${result}"
if [ "${result}" -eq "0" ] ; then
echo "Process is Running"
return 1
else
echo "Process is Stopped"
return 0
fi
}
echo Current Date and Time is: date +"%Y-%m-%d %T"
if (check_running_process); then
#Want to make sure it is not already being started
sleep 10
if (check_running_process); then
echo "Restarting Process now"
#syntax to restart the process
#insert your command to restart the process that is not running <-- Here is the command you would put in to start the process if it has died
fi
fi