configure monit on linux to monitor a process and then reboot

Posted by Elad Dotan on Server Fault See other posts from Server Fault or by Elad Dotan
Published on 2012-03-22T15:43:33Z Indexed on 2012/03/22 17:33 UTC
Read the original article Hit count: 320

Filed under:
|
|

I would like monit to monitor my service and once it's stopped then I want the computer to reboot. The process don't have a certain port that I can monitor. This is what I did:

check process chat with pidfile /var/run/chat.pid
start program = "/etc/init.d/chat start"
stop program = "/etc/init.d/chat stop"
if changed ppid then exec /sbin/reboot

I tried all sort of things but it only restart my service.

Any suggestion.

© Server Fault or respective owner

Related posts about linux

Related posts about centos