Re: Emulate pipe-tools' finish script using daemontools?

Daryl Tester <[email protected]> Sat, 01 Jul 2006 10:00:05 +0930
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
Jos Backus wrote:

> On Fri, Jun 30, 2006 at 09:08:30AM +0000, Gerrit Pape wrote:
>> Hi, we discussed this last year
>>  http://thread.gmane.org/gmane.comp.sysutils.supervision.general/824
>> 
>> and planned to implement it, but this didn't happen yet.  We didn't
>> really agree on what information should be passed to the ./run and
>> ./finish scripts, and how.
>  
> That's an interesting thread. It certainly gives me a new understanding of the
> issues.

I read through that as well.  While I understood the initial problem, I
wasn't so sure about the subsequent problems that thread raised.  For
example, if postrun needs to influence the subsequent run script in any
fashion other than svc manipulation, it could modify the context
appropriately, like writing to the env directory.  Although there is
a cycle between run and postrun being invoked, I wanted to emphasize
that they're really separate iterations with information flow primarily
from run script to postrun.  i.e. I considered feeding the postrun exit
status back to run, but rejected it for that reason - postrun influences
through action, not information (although those actions may result in
information being produced).

> Since I need a solution _now_ I'm going to go with Daryl's daemontools patch
> but will rename his `postrun' script to `finish' for compatibility reasons.

That's your choice, but bear in mind I don't think they're 100% compatible.

> On the topic of `finish' script compatibility: if the three approaches cannot
> agree on a standard calling convention it would be useful for a finish script
> to be able to detect under which supervision tool it is being run. That eases
> migration between the various solutions.

My solution to that would be to have the postrun script invoke the finish
script, after suitable mangling of the arguments.  If nothing executes
postrun, then you're not using my patch and finish is free to be invoked
by other methods.  :-)

Cheers.

-- 
Regards,
  Daryl Tester, IOCANE Pty. Ltd.