[systemd-devel] Adding a Timer section to .service files

Lennart Poettering lennart at poettering.net
Fri Jul 8 16:11:26 UTC 2016


On Fri, 08.07.16 19:00, One Infinite Loop (6pozmo at gmail.com) wrote:

> No, I understand perfectly why 2 files are needed. All I am saying is that,
> in some cases, a section like [Crontab] in a .service file (where you set a
> few commands to run every 15 seconds) would be very useful.

Well, but that would mean quite a redundancy in our most core file format, and I
am not a fan of that I must say. After all this way you'd have two
ways to define a time-triggered service: via a pair of timer+service
unit file, or via a service file with embedded timer section...

Besides that: systemd's loading logic is pretty simply right now:
essentially, if you start a unit "foobar.quux", then we look for a
file named "foobar.quux" on disk, and load it. If you could however
embedd the definition of "foobar.timer" in "foobar.service", then
finding the definitions becomes a lot different because for every
request for "foobar.timer" you'd need to look for "foobar.timer" *and*
"foobar.service" and probably similar for the other triggering unit
types and possible unit types that may be triggered, in any
combination... And I am really not sure I'd like such lookup logic.

Hope this makes sense,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list