[systemd-devel] How to properly write an "umbrella" unit

Dimitri John Ledkov dimitri.j.ledkov at intel.com
Tue Jul 21 06:20:39 PDT 2015


Heya,

On 21 July 2015 at 12:43, Marc Haber <mh+systemd-devel at zugschlus.de> wrote:
>
> Hi,
>
> I am trying to systemd'ize a daemon which is useful to be run in two
> instances. It is usually the case that both instances need to be
> started and stopped simultaneously, and the local admin would want a
> _single_ command to start and stop both instances. Therefore, an
> "umbrella" is needed.
>
> As a beginner, I have written:
>

Imho targets are ugly =)

I'd do a nifty at .service
with:
ExecStart=.... -%I -cf /etc/nifty/niftyd%I.conf

And then people can do e.g.:
systemctl enable nifty at 4.service nifty at 6.service
systemctl start nifty@*.service
systemctl stop nifty@*.service

And the install section would have e.g. default instance name 4, and
wanted by multi-user target.

And such service should be trivial to integrate into any maintainer scripts.

-- 
Regards,

Dimitri.
Pura Vida!

https://clearlinux.org
Open Source Technology Center
Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.


More information about the systemd-devel mailing list