[systemd-devel] instantiated services set up

Colin Guthrie gmane at colin.guthr.ie
Mon Sep 15 06:35:39 PDT 2014


Jan Včelák wrote on 15/09/14 12:03:
>>> > > 3.) In case of multiple instances, is there a way to control them all at
>>> > > once?
>>> > > 
>> > 
>> > Use PartOf= for this...
> OK. Thanks. I will take a look at it!

Just for a few more hints here:

You would create a knot.target unit which is just a standard target
unit, with a name and not much else, but it *would* have it's own
[Install] section with "WantedBy=multi-user.target"


In the knot at .service you would add: PartOf=knot.target and you would
*replace* the WantedBy=multi-user.target with WantedBy=knot.target.

This way, you can "systemctl enable knot at .service" and the default
instance will be enabled. But in this context, enabling it just means it
will start whenever knot.target starts, not multi-user.target.

THis means an admin can easily disable all instances of knot at .service
simply by doing: "systemctl disable knot.target"

This approach gives you nice flexibility and control over instance
units, but still gives you the ability to start/stop individual
instances and control all of them at once too!

HTHs

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list