Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 10202 invoked by uid 6000); 1 Jan 1998 21:11:39 -0000 Received: (qmail 10196 invoked from network); 1 Jan 1998 21:11:38 -0000 Received: from twinlark.arctic.org (204.62.130.91) by taz.hyperreal.org with SMTP; 1 Jan 1998 21:11:38 -0000 Received: (qmail 16363 invoked by uid 500); 1 Jan 1998 21:12:48 -0000 Date: Thu, 1 Jan 1998 13:12:48 -0800 (PST) From: Dean Gaudet To: Apache - BYOC Subject: Re: latest redhat rpm of apache In-Reply-To: Message-ID: X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. Organization: Transmeta Corp. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org 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 > >