[arch-general] Adopting start-stop-daemon in archlinux
clemens at endorphin.org
Thu Sep 8 06:08:30 EDT 2011
If you use Debian, you might have come across start-stop-daemon. It's
part of the dpkg package and encapsulates all the knowledge, they
learnt when dealing with starting and stopping daemons. It has plenty
of features ranging from:
* handling pidfiles more intimately (checking the pid files content,
verifying that the pid given actually is the executable in question)
* changing UID/GID
* chrooting, nice-ing
* retry starting if daemon dies
* creating pid files when the process doesn't do it, etc, etc.
curl http://clemens.endorphin.org/start-stop-daemon.c | less
if you want to have look for yourself. It's a single C file.
To me handling pid files correctly is the biggest win. The paradigm
used commonly in arch
PID=`pidof -o %PPID /usr/bin/executable`
[ -z "$PID" ] && /usr/bin/executable
is flawed and does not work reliably as shown here
I propose to switch to start-stop-daemon and deprecate the method above.
http://clemens.endorphin.org/sshd-start-stop-daemon.diff is an example
of an rc.d script ported to start-stop-daemon. The paradigm -- to my
personal taste -- is clean and simple. The diffstat is negative
We could either take the aur/start-stop-daemon packaging which
references dpkg.tar.gz or include into another core package.
start-stop-daemon.c is public domain.
Fruhwirth Clemens http://clemens.endorphin.org
More information about the arch-general