[systemd-devel] User/Group overrides in a templated service triggered via timer

Lennart Poettering lennart at poettering.net
Fri Sep 4 16:36:39 UTC 2020


On Mo, 31.08.20 16:50, Konstantin Ryabitsev (konstantin at linuxfoundation.org) wrote:

> On Mon, Aug 31, 2020 at 04:49:32PM -0400, Kevin P. Fleming wrote:
> > Yes, to get the instance-named symlink created.

This is not necessary.

Unit instances can be activated on-the-fly without further prepartion
or regsitration of the instance string or so. it's sufficient if the
template unit exists.

> Wouldn't that execute the service on boot, or does that not apply to
> oneshot items?

"Enabling" doesn't necessarily mean "start this at boot". Instead it
just means "start this at the hookpoints that are declared in the
unit's [Install] section". Typically this lists a hook point activated
that is run at boot, for example timers.target is the generic
hookpoint for timer units to be activated at boot, and
multi-user.target is the generic hookpoint for regular system services
(see systemd.special(5) for a list of other units that can be useful
hookpoints, if you are curious). However [Install] can list anything
it wants to, including for example "start me whenever apache starts"
or "start me whenever a bluetooth controller shows up".

Anyway, long story short: you typically do not enable services that
are only supposed to activated by timer units, enabling those timers
should entirely suffice, and the timers will start the services when
the time comes.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list