I\'m trying to set up a cron job as a sort of watchdog for a daemon that I\'ve created. If the daemon errors out and fails, I want the cron job to periodically restart it...
Consider using pgrep (if available) rather than ps piped through grep if you're going to go that route. Though, personally, I've got a lot of mileage out of scripts of the form
while(1){
call script_that_must_run
sleep 5
}
Though this can fail and cron jobs are often the best way for essential stuff. Just another alternative.