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

Lennart Poettering lennart at poettering.net
Fri Jul 8 16:06:57 UTC 2016


On Fri, 08.07.16 15:42, MichaƂ Zegan (webczat_200 at poczta.onet.pl) wrote:

> One thing to say: I heard, at least once, that systemd's timer are more
> complicated because in order to make a timer you need two files instead
> of creating one, especially in comparison to cron where you need just
> one line although I always forget the order of fields. I would say a
> timer section in the service file could be a nice shortcut to create
> timers for services quickly.

Yes, cron lines are much more condensed than .timer unit files, and
/etc/fstab lines are more condensed than .mount unit files. But I also
believe that unit files due to their relatively uniform and
self-describing format are much easier to read at least, as well as a
lot more extensible. After all, we do expose a number of options for
timer units that I wouldn't even know how one could condense into a
cron line... /etc/fstab files are a bit more extensible than cron
lines, since the options part allows adding in additional, new
settings, but it isn't really that pretty to write them all into the
fourth column of a single line, without any whitespace and so on.

Ultimately it's really a design decision: tabular file formats have
the benefit of being a lot more dense, but are neither particularly
extensible nor self-explanatory (as you need to know what each column
means). Unit files are a bit longer to write, but more extensible and
self-explanatory. When we designed this we preferred the latter two
properties over the density property.

I hope this makes sense,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list