Subject: Re: Suggested enhancement to rc.subr for "master daemons"
To: Ed Ravin <>
From: Lubomir Sedlacik <>
List: tech-userlevel
Date: 12/17/2004 20:56:14
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


On Fri, Dec 17, 2004 at 03:50:11AM -0500, Ed Ravin wrote:
> In my shop's NetBSD 2.0 environment, we have a daemon that's too dumb
> to write a pidfile.  The daemon also forks off children who may run
> for a while before they finish their work and quit.  So, when using
> the rc.d script (I'm calling the daemon "legacyd" here), it reports
> all the running daemons:
>  /etc/rc.d/legacyd status
>  legacyd is running as pid 4696 9508 15730 16870 19216 20215 21171 27041.
> This is OK for status, but when it's time to stop the daemon, we only
> want to kill the master - the children will exit when their work is
> done, and we'll have angry users coming after us with long sharp
> knives if we prematurely interrupt them.
> Unfortunately, our simple rc.d script will kill all the running
> processes unless we go to great lengths to write our own stop
> function.  It occured to someone here that we could distinguish the
> master daemon by using ps output to see if it's parent pid is 1, i.e.
> init, and it occurred to me that we might want this feature for more
> than one daemon.

you could write two simple functions for start_postcmd and stop_postcmd
to write and remove the master daemon pidfile for you.


-- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.6 (NetBSD)