I've just found a server where monit has been attempting to restart httpd for several days.
the monit config entry is:
check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
output in the monit.log is:
[BST Sep 5 18:55:07] debug : monit: pidfile '/var/run/httpd.pid' does not exist [BST Sep 5 18:55:07] error : 'apache' process is not running
[BST Sep 5 18:55:07] info : 'apache' trying to restart [BST Sep 5 18:55:07] debug : monit: pidfile '/var/run/httpd.pid' does not exist [BST Sep 5 18:55:07] debug : monit: pidfile '/var/run/httpd.pid' does not exist
[BST Sep 5 18:55:07] info : 'apache' start: /etc/init.d/httpd [BST Sep 5 18:55:07] debug : monit: pidfile '/var/run/httpd.pid' does not exist [BST Sep 5 18:55:07] debug : monit: pidfile '/var/run/httpd.pid' does not exist
[BST Sep 5 18:55:37] error : 'apache' failed to start
I think what is happening is that the restart and the start execution are over-lapping such that the removal of the pid file by the restart happens after the separate start. Why a restart is being attempted I do not understand.
This was corrected on the server by doing a manual kill of the httpd processes
and, BTW, reporting that the pid file does not exist as part of starting a process is, at best, redundant and at worse, confusing