[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to check for other init systems from sysvinit script



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.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Attachment: signature.asc
Description: Digital signature


Reply to: