[arch-general] Adopting start-stop-daemon in archlinux
mysatyre at gmail.com
Thu Sep 8 07:11:13 EDT 2011
On Thu, Sep 8, 2011 at 12:08 PM, Clemens Fruhwirth
<clemens at endorphin.org> wrote:
> 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
Although debian seems to do things thoroughly here (Whoa, 1400
SLOC!!!) and too much so in many other places, my most liked aspect in
using arch is that I know the two lines you posted quite well, which
for me doesn't fail in I guess the full range of aspects mentioned.
The only case in which the rc.d script fails for me is with mpd's
curl-straming, which sometimes breaks so badly it's not enough to just
stop it, in which case it's not enough to just restart the daemon,
because whatever kill signal is sent won't do and restarting will fail
because the port is taken.
My point is, with start-stop-daemon this behavior likely would not
change apart from an error message, please correct me if I'm wrong.
IIRC, start-stop-daemon is concipated for people who do mind looking
into their rc.d(init.d) scripts and go hunting for what went wrong,
which I, as an arch user, have absolutely no problem with.
I guess I could extend mpd's rc.d script to fall back to use kill -6
and maybe write a feature request or submit a modified package to aur.
More information about the arch-general