[PATCH] Write pid-file in httpd

Denys Vlasenko vda.linux at googlemail.com
Sun Jul 20 22:33:27 UTC 2008


Hi Ralf,

On Friday 18 July 2008 16:24, Ralf Friedl wrote:
> Some time ago I sent this patch for httpd. Is there something wrong with it or was it simply ignored?
> 
> This is a patch to create a pid-file when httpd is started.
> A pid-file is useful to stop httpd or to send SIGHUP to reload the config.
> The filename is passed as a parameter so that multiple instances can run 
> at the same time, with different pid-files.
> 
> It would also be possible to make this configurable.
> 
> Regards
> Ralf Friedl

I was sitting on it for some time. You know, I am not a big fan
of pid files. I am a fan of djb's style of doing things,
when filesystem is used as a fairly natural mapping to the
set(s) of running processes. I am talking about runsv/runsvdir
applets. Look at this gem:

SIGNALS
    Syslogd reacts to a set of signals. You may easily send
    a signal to syslogd using the following:
        kill -SIGNAL `cat /var/run/syslogd.pid`

Ok, I am not going to lecture everyone on "runsv way".
But for god's sake, use "killall -SIGNAL syslogd" or, if your system
has no killall (highly unlikely), "kill -SIGNAL `pidof syslogd`".
This should work, right? And unlike pidfile, killall is immune to
"stale pidfile" and "somehow two syslogd's were started, what now?!"
problems.

I remember that you propose having pifile's name specified as a param,
which makes pidfile not as rediculous at /var/run/syslogd.pid.
But still, would this work as well?

#!/bin/sh
echo $$ >pidfile
exec httpd "$@"

--
vda



More information about the busybox mailing list