[PATCH] Write pid files for klogd, ntpd and watchdog

Laurent Bercot ska-dietlibc at skarnet.org
Wed Dec 5 20:20:16 UTC 2012


> Several applets can be run as daemons, such as syslogd.  These
> write pid files but a few, like klogd, ntpd and watchdog, do not.
> We add write_pidfile() for these as is done for syslogd.

 Please don't, or at the very least, make it optional.

 1. PID files are a horrible hack coming from the Stone Age of Unix, and
they should be well on their way to oblivion by now. They have never been
reliable, they have been the bane of countless system administrators, and
they have prevented people from clean daemon handling for long enough.
 The right way to manage daemons is via supervision systems; even
mainstream Linux distributions like RedHat and Ubuntu have finally
figured that out and come with a "init" system that performs supervision,
and that does not need PID files.
 The write_pidfile() function should be marked as legacy, and hopefully
disappear in a future version of Busybox.

 2. Even if you are running a legacy init system with no control over
your daemons, making a shell script to get the PID of the process you
are launching and write it to a file is easy enough. System V init has
done this for decades. No need to bloat the applets' code with
functionality that is so easy to script.

 I am regularly using a few busybox applets as daemons - watchdog, for
instance. I will consider it a net quality drop in Busybox if those
daemons start writing pidfiles, which are just white noise on my
systems, and potentially dangerous (what if I have no /var/run ? should
the applet crash for failing to do something I don't need ? or should
it silently fail, and then also silently fail in situations when it
*should* report an error, on systems that use the feature ?)

-- 
 Laurent


More information about the busybox mailing list