On Fri, Mar 31, 2006 at 07:17:27AM +0200, Mike Hommey wrote:
> On Thu, Mar 30, 2006 at 10:51:03PM +0200, Wouter Verhelst <[EMAIL PROTECTED]> 
> wrote:
> > On Thu, Mar 30, 2006 at 06:22:23PM +0100, Rich Walker wrote:
> > > Sam Morris <[EMAIL PROTECTED]> writes:
> > > 
> > > >
> > > > That much is easy, but how do you turn a process ID into a script that
> > > > can be invoke-rc.d'd?
> > > 
> > > Make it part of the Debian spec?
> > > 
> > > define a known script name (logging-daemon) that must exist in
> > > /etc/init.d/ and can be a symlink to another one.
> > > 
> > > submit a small patch to each logging daemon to add/remove this link when
> > > the package is installed/removed?
> > 
> > Sounds ugly to me.
> > 
> > Here's another suggestion: start-stop-daemon is in a /very/ good
> > position to know which PID belongs to which initscript. Patch it so that
> > it writes the PIDs to some "database"[1] somewhere; then patch
> > invoke-rc.d to be able to use that "database". Probably best to do that
> > through some well-defined interface, rather than having invoke-rc.d
> > directly reading out that db, though.
> 
> It already does store the pid if called with the --pidfile option. Just
> make it mandatory.

Well, no. The --pidfile option expects the daemon to create its pid
itself; it doesn't make s-s-d create it. It can't do that, either, since
a proper daemon will fork() before doing anything useful, meaning, you
don't have anything to check a pid of anymore.

Even if it did, it isn't the solution. The pidfiles that s-s-d knows
about have a "something"->pid mapping. There is no link to the exact
initscript that needs to be called (the initscript is supposed to know
where its pidfile is), so they're not very useful. And if you fix that,
you're still faced with the problem that to look up the pidfile that
belogns to a given PID, you need to open() all those files in sequence
until you find the right one, which isn't very efficient.

What I'm suggesting is, actually, the reverse of a pidfile, in some way.
You'd still have your /var/run/syslogd.pid; but, assuming that file
contained the PID "2722" (as it currently does on my system), you'd also
have a file called "2722" somewhere (say, under "/var/run/pidlookups")
which would contain "/etc/init.d/sysklogd".

With such a system, you'd be able to say "restart whatever PID 2722 is".
Or even to force-reload it, if that'd be enough.

-- 
Fun will now commence
  -- Seven Of Nine, "Ashes to Ashes", stardate 53679.4


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to