[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Monit Can't Stop Apache
From: |
David Fletcher |
Subject: |
Re: Monit Can't Stop Apache |
Date: |
Mon, 28 Feb 2005 23:17:36 +0000 |
Hi Chris,
I'm not sure this will cure your problem with the pid file, but I include this
in the Apache start-up script (/etc/rc.d/rc.httpd) to cope with the case of
the stored PID file pointing to a process which is not httpd, or which
doesn't exist.
The variables $CHROOT and $PIDFILE are defined higher up in the start-up
script to point to the location of the pid file, and also the chroot jail in
which Apache runs. Just set $CHROOT to an empty string if you don't use a
chroot.
----------------------------------------------
#Check that an old PID file has not got left after power outage etc.
#If a PID file exists, check it points to a running httpd
if [ -f $CHROOT$PIDFILE ] ; then
PID=`cat $CHROOT$PIDFILE`
PIDPROC=`ps -p $PID -o comm --no-headers 2>/dev/null`
if [ "x$PID" != "x" ] && [ "x$PIDPROC" != "xhttpd" ] ; then
#pid points to a valid process, but it is not httpd
rm $CHROOT$PIDFILE 2>/dev/null
fi
fi
----------------------------------------------
I place it just before the line which starts in /etc/rc.d/rc.httpd
case $ARGV in
so it is executed for any start/stop/restart.
Regards,
David.
On
address@hidden wrote:
> 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.
--
-------------------------------------------------
Email: address@hidden
-------------------------------------------------
- Re: Monit Can't Stop Apache,
David Fletcher <=