Hi,
I have a problem that monit issues "start" command before "stop" is finished. My service creates pid file and my init.d script removes pid file in "stop". So what happens - when I execute
monit restart myservice
it does:
stop
start
but stop is not synchronous - part that removes pid file is not finishes when start is executed. So this leads to the situation that start creates a pid file and rest of stop deletes it. And monit starts to complain that no pid file exists.
My question: how to force monit to wait till "stop" action in init.d script finishes and only after do start?
and just to my own education - how monit decides that start should be run?
my monit script is pretty standard:
check process apache with pidfile /var/run/mydaemond.pid
start program = "/etc/init.d/mydaemond start"
stop program = "/etc/init.d/mydaemond stop"
Thank you,
Denis