On Thu, May 30, 2013 at 02:07:10PM -0700, Steve Langasek wrote:
> On Thu, May 30, 2013 at 10:00:40PM +0100, Ben Hutchings wrote:
> > On Thu, May 30, 2013 at 10:39:55PM +0200, Ondřej Surý wrote:
> > > Practical question: if I were to support systemd .service, upstart
> > > init job and/or OpenRC <whatever> together with standard sysvinit
> > > script, how do I check for currently used init system from sysvinit
> > > script to not start the service for a second time?
> 
> > . /lib/lsb/init-functions
> 
> > (Which should be near the top of your init script already.)
> > This will automagically invoke systemd or upstart if appropriate.
> 
> No, it won't.  What it will do is provide a shell function you can call to
> check if init is upstart, and if so, neuter your init script:
> 
>   if init_is_upstart; then
>     exit 1
>   fi
> 
> Doing this automatically by including /lib/lsb/init-functions would be EBW.

I feel it would be DWIM.  It really is what systemd does, but I'm sure
that merely confirms your opinion. ;-)

If I understand you correctly:
- For services without an upstart job, the init script can start or
  stop a daemon outside of the control of upstart.
- For services with an upstart job, the init script needs this
  explicit check and will fail *without any error message* if upstart
  is running.  (I seem to recall, now, that upstart does not assume
  any relationship between similarly named jobs and init scripts.)

Now I realise we should all really use the 'service' command, but
that really seems like an extremely ungraceful degradation of the
behaviour of directly invoked init scripts.

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20130530214155.gt4...@decadent.org.uk

Reply via email to