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

hi,

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:
>=20
>  /etc/rc.d/legacyd status
>  legacyd is running as pid 4696 9508 15730 16870 19216 20215 21171 27041.
>=20
> 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.


regards,

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

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iD8DBQFBwzneiwjDDlS8cmMRAqT6AJ4i6GLpBrkHGmZ87BkD4FE5hXcWCACggyT4
KgsTju0fHTUic92WvcbkGmA=
=jDeG
-----END PGP SIGNATURE-----

--rPH0Y77Oimr1cvNq--