[systemd-devel] [EXT] Re: Can I use an EnvironmentFile to configure a Timer?
Windl, Ulrich
u.windl at ukr.de
Thu Aug 22 10:36:33 UTC 2024
Hi Lennart,
the good news is that supporting it would not break any existing timer units, so it could be a nice enhancement.
As I think editing timer unit instances is somewhat ugly, I think I will provide a set of differently named timer templates like
my-service-daily at .timer
my-service-hourly at .timer
...
that all run my-service@%i.service.
So you could create an instance for the timer that fits you best. It's not really beautiful, but still it's more comprehensible than editing individual timer units IMHO.
Kind regards,
Ulrich
> -----Original Message-----
> From: Lennart Poettering <mzxreary at 0pointer.de>
> Sent: Thursday, August 22, 2024 11:26 AM
> To: Windl, Ulrich <u.windl at ukr.de>
> Cc: systemd-devel at lists.freedesktop.org
> Subject: [EXT] Re: [systemd-devel] Can I use an EnvironmentFile to configure
> a Timer?
>
> On Mo, 05.08.24 08:08, Windl, Ulrich (u.windl at ukr.de) wrote:
>
> > Hi!
> >
> > I have a service and timer template where the service instances are
> configured via an environment file like etc/.../%i.conf.
> > The timer template will use the @%i.service unit, but currently has a fixed
> "OnCalendar=daily" currently.
> > As the instances might want to run with a different frequency, one could
> "edit" the time files.
> > However I had the idea to read the timer interval from an environment
> variable like "OnCalendat=${interval}".
> > However, AFAIK, environment variables are supported in service units
> only, right?
>
> We only do env var expansion in ExecStart= and related line
> types. Nothing else. (And I think it actually was a mistake there too.)
>
> Lennart
>
> --
> Lennart Poettering, Berlin
More information about the systemd-devel
mailing list