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...
The way I am doing it when I am running php scripts is:
* * * * * php /path/to/php/script.php &
1) {
exit('already running...');
}
// do stuff
This command is searching in the system process list for the current php filename if it exists the line counter (wc -l) will be greater then one because the search command itself containing the filename
so if you running php crons add the above code to the start of your php code and it will run only once.