On Dec 29, 2009, at 10:59 PM, Dan Urist wrote: > On Tue, 29 Dec 2009 20:12:47 +0100 > Martin Pala <mart...@tildeslash.com> wrote: > >> In this case monit should restart the process - can you try to run it >> with -v option?: >> >> monit -vI >> >> I think the problem could be that the startup script which is called >> by monit exits when it finds existing pidfile. > > On further investigation, it seems that monit can handle a start action > correctly with an empty pidfile, but not a stop action. This is where > I'm getting the "pidfile does not exist" error, and the init script is > never being run (I checked the init script; it just does a pkill > without looking at the pidfile).
The stop action for "check process" is called only when process' pid is running - if process wasn't found, stop is skipped as it is supposed to be unnecessary when process doesn't exist already. You can fix this by making sure that the start script will kill the process ... either modify the start script or set monit start action like this: check process myprocess with pidfile ... start program = "/bin/bash -c '/bin/pkill -9 myprocess; /etc/init.d/myprocess start'" ... When process will fail (even if pidfile will be empty), restart action which calls start will kill the process. Martin -- To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general