Re: how to wrap properly a Red Hat / CentOS service into a daemontools service ?

Brian Reichert <[email protected]> Wed, 5 Jan 2011 13:12:43 -0500
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
On Wed, Jan 05, 2011 at 03:01:25PM +0100, Romain Pelisse wrote:
> I'll like your approach, and especially like the idea of having
> the "status" option of the service working (however, this can also be
> confusing if somebody is led to believe that service xxx stop will work as
> suspected - probably need to map this to the daemontools equivalent).

It all depends on what 'work as suspected' means.  Both daemontools
and classic RC scripts usually just send a signal to a known pid,
and don't wait to see if it 'takes'.  We had some pretty strong
dependencies on blocking until a service 'completely' consumed/released
resources.

As for 'status', some people on the exit status of the 'service'
command, and others rely on the human-readable output of the command.

> Anyhow, it sounds to me that you actually wrote your own init.d script
> rather than reusing the one provided by the distribution for instance, if I
> want to daemontoolize nginx I need to wrote myself an /etc/init.d/nginx
> scripts rather than use in my run script the one already provided by
> package.

I did, in all cases, write my own init.d script, that merely referred
to the analogous 'svc' directive.  (Under the hood, it also reported
on the associated multilog process.)

> About that, I just wonder, did you try to salvage those scripts (as they
> are) - and maybe run into any issue preventing you to do so ?

I usually was able to roll my own; most apps have either flags or
configuration directives to direct IO to STDOUT, and to run in the
foreground.  It was usually worth it to me, as I could export much
parametrization to the envdir mechanism (which in turn was actually
a hassle from a RPM packaging point of view, but c'est la vie.)

'heartbeat' is an example of one I could not readily convert; it
is actually a whole family of processes (including it's own logging
daemon), and a master process that tries to drive it all.

> -- 
> Romain PELISSE,
> *"The trouble with having an open mind, of course, is that people will
> insist on coming along and trying to put things in it" -- Terry Pratchett*
> http://belaran.eu/wordpress/belaran

-- 
Brian Reichert				<[email protected]>
55 Crystal Ave. #286			
Derry NH 03038-1725 USA			BSD admin/developer at large