[NBLUG/talk] Apache Logs..

Eric Eisenhart eric at nblug.org
Wed Apr 2 19:55:06 PST 2003


On Wed, Apr 02, 2003 at 06:41:17PM -0800, ME wrote:
> If this is logrotate, then it may just not be apache-educated. To see how
> apache is expected to be started/stopped, check out apachectl (should be a
> script on many systems)
> 
> If you want to educate logrotate on how to gracefully stop apache, then
> you can send a SIGTERM to the parent process for apache and that should
> stop apache. As an alternative, you may be able to educate logrotate on
> how to use apachectl and pass it the arg "stop" and start for a graceful
> shutdown.

SIGTERM?   Yikes.

With apache, it's best to do the least damage required for the job. 
Absolute least damage is SIGUSR1 (apachectl graceful[1]), which will wait for
existing connections to finnish and then reload the configuration and reopen
all log files.  Next least damage is SIGHUP (apachectl restart), which will
kill existing connections immediately and then reload the configuration and
reopen all log files.  If you stop and then start with SIGTERM (apachectl
stop), the service is totally unavailable for a period of time ("connection
refused").  With USR1 and HUP, during the restart those connections get
queued and then handled after it's running again.  Even on a very busy
server, SIGUSR1 (apachectl graceful) will feed out all data it's supposed
to, merely delaying responses for a moment to some clients.

In the case of logrotation, SIGUSR1 has the problem that it's not
instantaneous (while SIGHUP is).  Better to just wait....  Say, "apachectl
graceful && apachectl status > /dev/null", perhaps?

[1] "apachectl graceful" is actually more than just SIGUSR1, it also checks
    the apache configuration before restarting and will start apache if its
    not running.  It's the DWIM apachectl option.
-- 
Eric Eisenhart
NBLUG Co-Founder & Vice-President Pro Tempore
The North Bay Linux Users Group
http://nblug.org/
eric at nblug.org, IRC: Freiheit at freenode, AIM: falschfreiheit, ICQ: 48217244



More information about the talk mailing list