httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: latest redhat rpm of apache
Date Thu, 01 Jan 1998 21:12:48 GMT
Actually when I mailed ewt@redhat.com about the kill -9 problem he
asked me if there was any way for him to know the daemon had died.
I said there wasn't and was there another daemon that behaved in a way he
liked 'cause I could emulate it.  He said nope, it's a general problem,
a solution would be great.  So here's my proposed solution.

After setting up the pid file the parent acquires a sharable lock on it.
(The parent exits if the lock fails).  Each child also child acquires
a sharable lock.  flock() or fcntl() will work for this.

A support utility "waitlock filename timeout" attempts to acquire an
exclusive lock on filename.  Once it has acquired the exclusive lock
it exits with code 0.  On any error it exits with code 1, on timeout it
exits with code 2.

Then shutting down the server becomes:

    kill -TERM `cat /var/run/httpd.pid`
    waitlock /var/run/httpd.pid 600
    exit $?

I suppose you could do kill -9, but I kinda hate doing that even in
completely broken situations, especially in scripts.  "killall -9 httpd"
could take out completely unrelated httpds.

There's another use for this type of locking:  kill -USR1.  If you modify
the children to all share lock the log files, then doing a waitlock
after a rotation attempt will let you continue when all the children
have completed.  But this still isn't as nice in my opinion as using a
piped logger, because the piped logger can rotate immediately.

But I think this is a nice way to know a signal has been received and
processed.  An alternative is to use a control interface somewhat like
INN does -- via a unix domain socket.

Dean

On Thu, 1 Jan 1998, Gregory A Lundberg wrote:

> On Thu, 1 Jan 1998, Marc Slemko wrote:
> 
> > Does it compress the logs at all?
> 
> Compress 'em?  Be glad they finally fixed the signals.  They still rotate
> Samba logs without signalling causing the files to grow with zillions of
> NUL bytes at the front.
> 
> ----
> 
> Gregory A Lundberg		Senior Partner, VRnet Company
> 1441 Elmdale Drive              email: lundberg@vr.net [205.133.13.8]
> Kettering, OH 45409-1615 USA    voice: +1 (937) 299-7653
> 
> 


Mime
View raw message