Jos Backus wrote:
> On Mon, Oct 27, 2003 at 10:31:18AM -0500, Dan Langille wrote:
> > If a process starts up and does a setuid, should it be writing the
> > PID file before or after the setuid?
> > Two methods exists AFAIK:
> > 1 - write your PID immediately, and the file is chown root:wheel
> > 2 - write your PID to /var/run/myapp/myapp.pid where /var/run/myapp/
> > is chown myapp:myapp
> > Of the two, I think #1 is cleaner as it does not require another
> > directory with special permissions.
> > Any suggestions?
> Why use pid files at all if you could be using a process supervisor instead?
Who supervises the supervisor? Sure, you can take the English
Bobby approach (init dies, the kernel yells "Help me, human, or
I shall yell 'Help me Human!' again", and tries to start software
that will never start over and over), but that solves nothing;
you would be amazed at the number of people who want MacOS X to
try to restart init, instead of panicing, when init can't be
started in the first place, or won't stay running if it was.
So this doesn't solve the origin of authority problem.
The problem being solved is avoiding running multiple instances
of roles... so actually, it would be better if the file were
named e.g. "smtp.pid", rather than "sendmail.pid", which would
step on the toes of everyone who wanted to use their program name
as part of the file name to make it harder to use someone else's
software to replace their software.
There are also the small issues of ordering (the reason you can't
just run everything out of /etc/ttys via init in the first place),
multiple instances, and removing human error from adding and
removing new things to be monitored.