Patch for BusyBox httpd
Giuseppe Ciotta
giuseppe at telvia.it
Tue Jul 11 17:26:21 UTC 2006
On Tue, Jul 11, 2006 at 11:39:14AM -0400, Rich Felker wrote:
> On Tue, Jul 11, 2006 at 05:05:19PM +0200, Richard Braun wrote:
> > On Tue, Jul 11, 2006 at 04:55:39PM +0200, Giuseppe Ciotta wrote:
> > > > The problem with start-stop-daemon is that it relies on the daemon to
> > > > create its PID file. When the daemon doesn't, it usually provides an
> > > > option to force running in the foreground, so that you can use
> > > > start-stop-daemon with --background and --make-pidfile. The problem with
> > > > busybox httpd is that it doesn't provide such an option.
> > >
> > > What about adding the option to go in foreground and leave the pid
> > > writing task to start-stop-daemon then?
> >
> > It's one solution, but usually, a daemon is designed to run in the
> > background, so using an option to run in the foreground for a daemon
> > designed to run in the background is not really logic. The usual way,
> > again, is that the daemon has an option to write his PID file. The
> > best implementation has both : it can write the PID file, and it
> > can run in the foreground, depending on the user options.
>
> I agree, this is a much more sane approach. I never understood the
> obsession with start-stop-daemon.
>
Well, it's not a matter of obsession with start-stop-daemon, actually
i rarely use it and usually a plain simple
daemon & echo $! > pidfile
is enough for what i need to do (well, you may also need to cd to /
and redirect std{in,out,err} to /dev/null in order to have the same
behaviour of daemon())
I don't see why it's not logic to have a -fg option, a lot of daemons
actually have options to run in foreground (apache, proftpd, sshd
among others...), this gives the opportunity to easily monitor the
daemon from within shell scripts, like
while true; do daemon ; snmpset daemon.died.variable ; done
instead of polling a pidfile and sending baroque vintage signals to
processes to see if they're alive.
Just suggestions...
Ciao.
--
More information about the busybox
mailing list