using monit to restart custom daemon

Posted by Jenis Sam on Server Fault See other posts from Server Fault or by Jenis Sam
Published on 2012-04-04T01:51:12Z Indexed on 2012/04/04 5:31 UTC
Read the original article Hit count: 482

Filed under:
|
|

I wrote a php daemon using system daemon pear class.

How do I use monit to restart it when it fails?

I have the following code in my monit config file:

check process merge with pidfile /var/www/merge/merge.pid
group 1000
start program = "/etc/init.d/merge start"
stop program = "/etc/init.d/merge stop"
IF CHANGED PID then restart

My goal is solely if the daemon fails (stops running because of an error), I want monit to make it start running again.

© Server Fault or respective owner

Related posts about php

Related posts about unix