httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22960] New: - Problem with pid file when restarting chrooted Apache after a power outage.
Date Sat, 06 Sep 2003 19:30:40 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22960>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22960

Problem with pid file when restarting chrooted Apache after a power outage.

           Summary: Problem with pid file when restarting chrooted Apache
                    after a power outage.
           Product: Apache httpd-2.0
           Version: 2.0.44
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: support
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: david@megapico.co.uk


Problem with pid file when restarting Apache after a power outage.

I found a problem with restarting Apache after a power outage. Apache
is running in a chroot, but I'm not sure if that is critical. A few
additional lines in apachectl solve this problem, as explained below.

The pid file for httpd was not removed when power to the server was
cut, so httpd found the pid file on start-up and would not start a new
httpd process. It is necessary to check using apachectl that if a pid
file exists, it really belongs to a running httpd. If it does not,
then it can be safely removed, allowing a new copy of httpd to be
started.

When specifying the location of the pid file in apachectl it is
important to specify it relative to the root of the file system, not
the root of any chroot that apache is to run in. Having to specify the pid
location reverts to Apache 1.3 format, rather than finding the info from the
config files, but whereever it is specified, the need to take account of chroot
will still exist.

This looks similar to bug  14647.

-------------------------------------------------
Required changes to apachectl to fix this:

Add to CONFIGURATION SECTION:

# the path to your PID file, prior to chroot set-up, if any
PIDFILE=/chroot/apache2/usr/local/apache/logs/httpd.pid

Add before "case $ARGV in":

#Check that an old PID file in chroot has got left after power outage etc.
#If a PID file exists, check it points to a running httpd
if [ -f $PIDFILE ] ; then
    PID=`cat $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 $PIDFILE 2>/dev/null
    fi
fi

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message