[juneau-lug] Re: Apache presentation

  • From: "James Zuelow" <e5z8652@xxxxxxxxxx>
  • To: <juneau-lug@xxxxxxxxxxxxx>
  • Date: Mon, 8 Apr 2002 00:21:59 -0800


----- Original Message -----
From: "James Zuelow" <e5z8652@xxxxxxxxxx>
To: <juneau-lug@xxxxxxxxxxxxx>
Sent: Sunday, April 07, 2002 3:55 PM
Subject: [juneau-lug] Apache presentation


> apachectl does not get installed correctly.  You have to manually modify
> it for Linux installs.  For OpenBSD it doesn't seem to work at all (even
> with the script paths corrected an `apachectl stop` will not stop the
> server, although it reports back as if it does).

After some experimentation (which my wife didn't enjoy) I think that the
apachectl script may well be working fine - the httpd binary itself is
ignoring signals sent to it.  An `apachectl configtest` will check the
httpd.conf syntax, and `apachectl start` is working, but nothing involving
stopping httpd is working at all.

For example, you should be able to tell an Apache binary to shut down (and
kill off the child processes) using this command:
kill -TERM `cat /var/www/logs/httpd.pid`
(assuming your httpd.pid is in /var/www/logs, which is the default OpenBSD
location.)

That command works for the 1.3.24 OpenBSD binary (compiled from source on
this box) but does not work for the 2.0.35 binary (also compiled from source
on this box).  Likewise SIGHUP and SIGUSR1 have no effect.

So the next step is to figure out if I set a compile option incorrectly,
file permissions are wrong (they're identical to the 1.3.24 server though),
or if there really is a problem with 2.0.35 and OpenBSD.  I did a quick
google and didn't find anything, but then again 2.0.35 has only been out for
a few days.  I am not a coder, so looking at the source is useless for me
without someone else explaining it.  If you see anything online, please
point it out.

Anyway, a short term solution is to perform a very ugly massacre of httpd
and then restart it:

#!/bin/sh
# kill the main httpd process and all children manually
# (since kill -TERM does not work):
kill -9 `ps ax | awk '/usr\/sbin\/httpd/ { print $1 }' ORS=" "
# remove the httpd.pid file to prevent a warning in error_log
# (although the warning is probably a good idea in this case)
rm /var/www/logs/httpd.pid
# and restart Apache the old fashioned way:
/usr/sbin/httpd
exit 0

The end result is a restarted httpd.  Note that you have to kill -9 the
httpd process - otherwise, it will just spawn more children in order to
maintain the minimum servers set in httpd.conf.

This is the fastest (only) way to reload configuration changes on my OpenBSD
box, since I can't send the restart command.  However it is not pretty if
someone is in the middle of a transaction - downloading a graphic or web
page - since their httpd server just dies with no warning.  Luckily my home
page is a very low traffic site, and I'm not worried about inconveniencing
the various Nimda scans that otherwise fill up my logs.  I just keep a
tail -f on the access_log running in the background to make sure a real
person isn't looking at something.

Cheers,

James


------------------------------------
This is the Juneau-LUG mailing list.
To unsubscribe, send an e-mail to juneau-lug-request@xxxxxxxxxxxxx with the 
word unsubscribe in the subject header.

Other related posts: