[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Best practice for dealing with missing pidfile while service is running
From: |
Bill Durant |
Subject: |
Best practice for dealing with missing pidfile while service is running |
Date: |
Thu, 4 Feb 2016 11:11:06 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
Greetings:
Is there a best practice for dealing with a situation when a service's
PID file is deleted by something other than the service itself?
For example, given the following monit rule:
check process ntpd with pidfile /var/run/ntpd.pid
start program "/etc/init.d/ntpd start"
stop program "/etc/init.d/ntpd stop"
If /var/run/ntpd.pid is deleted by the root user from the command line,
then monit will start it again resulting in two instances of ntpd.
A workaround that I discovered is to tell monit to 'restart' ntpd
instead of 'starting' it as follows:
check process ntpd with pidfile /var/run/ntpd.pid
start program "/etc/init.d/ntpd restart"
stop program "/etc/init.d/ntpd stop"
Is this a common practice or is there a better way?
Thanks!
Bill
- Best practice for dealing with missing pidfile while service is running,
Bill Durant <=