Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Nov 2003 02:45:18 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        jos@catnook.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: non-root process and PID files
Message-ID:  <3FB360BE.779DB42F@mindspring.com>
References:  <3F9CF3F6.8307.ABC1250@localhost> <20031111071944.GA5778@lizzy.catnook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FB360BE.779DB42F>