Hello, your solution is correct. Alternatively you can also use pattern based process check (no need for pidfile).
Regards, Martin > On 04 Feb 2016, at 20:11, Bill Durant <[email protected]> wrote: > > 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 > > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
