[Top][All Lists]

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

Re: Monit Can't Stop Apache

From: Martin Pala
Subject: Re: Monit Can't Stop Apache
Date: Sat, 26 Feb 2005 20:59:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1

Apache (1.x) uses preforked-child model - the parent process is kind of manager. If you will kill it, child processes will be inherited by init process (PID=1) and will keep running. Because httpd pidfile now contains nonexistent parent process PID reference, monit thinks that the process is not running (which is true - monit watches just specified process, not its childs) and will skip stop script during restart.

The solution is quite easy - to make sure that there is no orphaned apache child process running, you can add 'pkill httpd' (or 'killall httpd') to start section of httpd init script before actual attempt to start the httpd.

Chris Lopeman wrote:
Hi All,

I am still trying to get my Monit setup just right. In doing so I have been testing it quite a bit. Every once in a while I need to tell Monit to quit. This is because it wont restart and connect to a service. I tried starts and restarts and monitor and unmonitor, all through Monit and nothing fixes the issue. I have experienced this with a few different services but have never really been able to reproduce it consistently. However, I think I have recently reproduced this with apache and was wondering if anybody knew what was happening or how it can be fix. Basically all I seem to need to do is kill -9 the parent httpd. At that point monit seems unable to stop the service. I looked at the httpd script. It does a killproc and I can't see why that would not work. If I run /etc/init.d/httpd stop, it does work. But not monit stop apache. Please correct me if I am wrong, but I believe the following is happening. Monit does not see the process corresponding to the pid in the run file. So it does not call httpd stop. Therefore when httpd restart is called it fails. Assuming what I have said is correct, then I pose the question. Are there other circumstances this symptom can occur. I believe so because I know I have seen the same affect without doing a kill -9. I wonder if there are other time the stop will not be called. Maybe if the pid in the file gets out of sync with the running process. Or if there is no PID file at all. As far as apache goes, I am considering changing my monit start call to "httpd restart".

Thanks ahead of time,



To unsubscribe:

reply via email to

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