monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

monit restart and pid file for daemon via init.d script


From: Denis Samoilov
Subject: monit restart and pid file for daemon via init.d script
Date: Tue, 28 Oct 2014 09:32:57 -0700

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]