You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sander Temme <sc...@covalent.net> on 2001/09/14 02:13:12 UTC
[PATCH] apache-1.3/src/support/apachectl
Ever been bitten by this? I just had an overnight benchmark run go nowhere
because I believed apachectl's output and assumed httpd was running
correctly. The following patch makes apachectl at least look back to see if
httpd is running. It checks the presence of the PID file which should be
enough under normal circumstances, like in case there already is a httpd
deamon running.
Enjoy,
S.
--- src/support/apachectl~ Thu Sep 13 13:54:40 2001
+++ src/support/apachectl Thu Sep 13 17:09:26 2001
@@ -69,7 +69,19 @@
continue
fi
if $HTTPD ; then
- echo "$0 $ARG: httpd started"
+ sleep 1
+ if [ -f $PIDFILE ] ; then
+ PID=`cat $PIDFILE`
+ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+ echo "$0 $ARG: httpd started"
+ else
+ echo "$0 $ARG: httpd (pid $PID?) not running"
+ ERROR=3
+ fi
+ else
+ echo "$0 $ARG: httpd not running: no pid file"
+ ERROR=3
+ fi
else
echo "$0 $ARG: httpd could not be started"
ERROR=3
@@ -91,7 +103,19 @@
if [ $RUNNING -eq 0 ]; then
echo "$0 $ARG: httpd not running, trying to start"
if $HTTPD ; then
- echo "$0 $ARG: httpd started"
+ sleep 1
+ if [ -f $PIDFILE ] ; then
+ PID=`cat $PIDFILE`
+ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+ echo "$0 $ARG: httpd started"
+ else
+ echo "$0 $ARG: httpd (pid $PID?) not running"
+ ERROR=3
+ fi
+ else
+ echo "$0 $ARG: httpd not running: no pid file"
+ ERROR=3
+ fi
else
echo "$0 $ARG: httpd could not be started"
ERROR=5
@@ -115,7 +139,20 @@
if [ $RUNNING -eq 0 ]; then
echo "$0 $ARG: httpd not running, trying to start"
if $HTTPD ; then
- echo "$0 $ARG: httpd started"
+ sleep 1
+ if [ -f $PIDFILE ] ; then
+ PID=`cat $PIDFILE`
+ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+ echo "$0 $ARG: httpd started"
+ else
+ echo "$0 $ARG: httpd (pid $PID?) not running"
+ ERROR=3
+ fi
+ else
+ echo "$0 $ARG: httpd not running: no pid file"
+ ERROR=3
+ fi
+ else
else
echo "$0 $ARG: httpd could not be started"
ERROR=5
--
Covalent Technologies sctemme@covalent.net
Engineering group Voice: (415) 536 5214
645 Howard St. Fax: (415) 536 5210
San Francisco CA 94105
PGP Fingerprint: 1E74 4E58 DFAC 2CF5 6A03 5531 AFB1 96AF B584 0AB1
=======================================================
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message
=======================================================
Re: [PATCH] retry: apache-1.3/src/support/apachectl
Posted by Sander Temme <sc...@covalent.net>.
on 9/13/01 5:13 PM, Sander Temme at sctemme@covalent.net wrote:
That'll teach me to change the script after testing it. Humble apologies:
--- src/support/apachectl~ Thu Sep 13 13:54:40 2001
+++ src/support/apachectl Thu Sep 13 18:16:17 2001
@@ -69,7 +69,19 @@
continue
fi
if $HTTPD ; then
- echo "$0 $ARG: httpd started"
+ sleep 1
+ if [ -f $PIDFILE ] ; then
+ PID=`cat $PIDFILE`
+ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+ echo "$0 $ARG: httpd started"
+ else
+ echo "$0 $ARG: httpd (pid $PID?) not running"
+ ERROR=3
+ fi
+ else
+ echo "$0 $ARG: httpd not running: no pid file"
+ ERROR=3
+ fi
else
echo "$0 $ARG: httpd could not be started"
ERROR=3
@@ -91,7 +103,19 @@
if [ $RUNNING -eq 0 ]; then
echo "$0 $ARG: httpd not running, trying to start"
if $HTTPD ; then
- echo "$0 $ARG: httpd started"
+ sleep 1
+ if [ -f $PIDFILE ] ; then
+ PID=`cat $PIDFILE`
+ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+ echo "$0 $ARG: httpd started"
+ else
+ echo "$0 $ARG: httpd (pid $PID?) not running"
+ ERROR=3
+ fi
+ else
+ echo "$0 $ARG: httpd not running: no pid file"
+ ERROR=3
+ fi
else
echo "$0 $ARG: httpd could not be started"
ERROR=5
@@ -115,7 +139,19 @@
if [ $RUNNING -eq 0 ]; then
echo "$0 $ARG: httpd not running, trying to start"
if $HTTPD ; then
- echo "$0 $ARG: httpd started"
+ sleep 1
+ if [ -f $PIDFILE ] ; then
+ PID=`cat $PIDFILE`
+ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
+ echo "$0 $ARG: httpd started"
+ else
+ echo "$0 $ARG: httpd (pid $PID?) not running"
+ ERROR=3
+ fi
+ else
+ echo "$0 $ARG: httpd not running: no pid file"
+ ERROR=3
+ fi
else
echo "$0 $ARG: httpd could not be started"
ERROR=5
--
Covalent Technologies sctemme@covalent.net
Engineering group Voice: (415) 536 5214
645 Howard St. Fax: (415) 536 5210
San Francisco CA 94105
PGP Fingerprint: 1E74 4E58 DFAC 2CF5 6A03 5531 AFB1 96AF B584 0AB1
=======================================================
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message
=======================================================