Actually I am using Apache 2.0.?. However, I would assume the same
holds true. What you have suggested is basically to create a custom
script to clean up Apache if parts are still running. But that seems
kind of silly to do since "httpd restart" already does a great job of
this. You seem to be implying that there is something wrong with
calling "httpd restart".
Anyway I think I was too subtle. My real questions more general.
Should people setting up monit seriously consider using restart on each
process instead of start? Or should monit trust the stop scripts more
and just run them? After all should not they be best at detecting if
it is still running and if anything needs to be cleaned up. Maybe the
best of both worlds is to provided monit with a flag for each stop
command that tells it to force the stop to run or not.
Thanks for listening,
Chris Lopeman
Martin Pala wrote:
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,
Chris
------------------------------------------------------------------------
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
|