You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Harris <dh...@drh.net> on 1999/05/13 05:06:55 UTC
Apachectl hanging if server not up
Hi,
I wrote a little script to check my web server and see if it's up which is
just a front end to apachectl using the "status" and "start" commands.
However, there is a problem with apachectl... if you do a "status" request
and the web server is not up, lynx hangs trying to open a TCP connection...
for minutes, not seconds. This is fine for human use of apachectl because
you just terminate it when it hangs, but this breaks my script.
Here's my solution:
#####
--- apachectl.orig Wed May 12 22:42:04 1999
+++ apachectl Wed May 12 22:48:07 1999
@@ -136,10 +136,14 @@
fi
;;
status)
- $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
+ if [ $RUNNING -eq 1 ]; then
+ $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
+ fi
;;
fullstatus)
- $LYNX $STATUSURL
+ if [ $RUNNING -eq 1 ]; then
+ $LYNX $STATUSURL
+ fi
;;
configtest)
if $HTTPD -t; then
#####
No need running lynx to get the status page if the server is not up...
Perhaps there is a way to set a timeout on lynx, but I don't see it.
(On second thought, my little script was useless.. I should just do a
"apachectl start" which does not start the server if it looks like it's
running. Sigh.)
- David Harris
Principal Engineer, DRH Internet Services