>
> I have been digging around the web for a sample implementation of a
> daemon that handles pid files, running under different users etc.
daemon-kit[1] has some great stuff for those that want help with
this / don't want to write it, and it's much cleaner and more complete
than a lot of other offerings.
HTH
A couple of people have reccomended this and I'll probably look into
it. It seems like "yet another thing to install, maintain, learn,
replicate etc" but obviously people seem to like it.
Here is the link.
It's a port of daemontools which was written by DJB (of qmail and
djbdns fame). I used daemontools a very long time ago when I was
running djbdns. My biggest grief was the non standard directory
layout and "yet another thing to learn, maintain, and upgrade"
headache.
Since runit is in the debian package list I hope it's been morphed to
be more standard.