Re: daemontools respin?

Charlie Brady <[email protected]> Wed, 16 Jun 2010 14:40:26 -0400 (EDT)
Newsgroups gmane.comp.sysutils.bgware
Message-ID <[email protected]>
On Wed, 16 Jun 2010, Bernhard Graf wrote:

> Charlie Brady wrote
> 
> > You do indeed have the same options. The run script for the dependent 
> > daemon can employ just the same heuristics to determine when the daemon 
> > that it depends on has fully started -  waiting for a PID-File to   
> > appear somewhere, waiting for a socket to become available, etc.
> 
> You mean when B depends on A to be up, B may check availabily of A?
> 
> Of course you can do it this way, but then B may be forced to have
> detailed knowledge about A's guts.

Maybe. But in general it only needs to know what its own needs are.

As Bruce G has suggested, a 'check' script provided by A can be used by B.

> Things become worse when B doesn't
> require a certain daemon, but only a service in general, that does
> something, e.g. any name server or any web server.
> 
> A clean way would be, if A can tell the supervisor: "I'm ready to
> process requests", and then the supervisor starts all services that
> depend on A.

Yes, that would be cleaner. But that does depend on all services A being 
modified to provide that signalling. I thought in this thread we were 
trying to avoid that requirement.

> Now go back to my recent mails, read again and then you might get how
> the same may be achieved in a typical SysV setup (with self-daemonizing
> daemons) quite easily.

  This is much easier with the synchronous SysV startup process, with
  self-daemonizing services: By terminating the main process such a daemon
  can indicate, that the daemonized subprocess is ready.

Your definition of "quite easily" might be different to mine. I will now 
ask you to go back and read my recent mails again. My experience is that 
there are very few (maybe none) self-daemonising services which wait in 
the parent before exiting. So I think you are suggesting that we each go 
in and hack apache/mysql/ntpd/smartd/hald etc so that custom "ready" 
signaling is done between child and parent in the fork/fork/exit section 
of code. Sure, that's a SMOP, but probably not "quite easy" for most of 
us.