I have a daemon written in PHP. I use the following command to call the daemon
php dojobs.php
when I call that command, the daemon runs infinitely because the file dojobs.php has the following code
while(true)
{
code here
}
I have the following questions:
- How do I use Monit (on a CENTOS linux 5.5) server to monitor this daemon and restart it if it has failed?
I have the following code inside the daemon:
exec('nohup sendMail.php > /dev/null 2>&1 & echo $!';, $op);
(how do I make sure the nohup command above works correctly and that the sendMail.php file actually does its job? The sendMail.php is not a daemon. It sends an email and then quits.)
Thank you so much.