systemd timer every 1 hour and X minutes?
I’m looking for a systemd timer to run every 1 hour and 18 minutes but I have this only lead.
systemd-analyze --iterations=3 calendar *:0/18 which is every 18 minutes.
For a monotonic timer that runs at regular intervals (e.g. every X minutes and Y seconds, every X days and Y minutes etc) you have to define a starting point and a repetition value. This can be accomplished by using two directives in the
The settings and their their starting points are explained in
sytemd.timer man page which also mentions that
Multiple directives may be combined of the same and of different
types, in which case the timer unit will trigger whenever any of the
specified timer expressions elapse. For example, by combining
OnUnitActiveSec=, it is possible to define a timer
that elapses in regular intervals and activates a specific service
So, for a timer that runs every 1 hour and 18 minutes you could use something like:
[Timer] Unit=test.service AccuracySec=1s OnActiveSec=5s OnUnitActiveSec=1h 18min
In the above, the initial trigger is
OnActiveSec=Defines a timer relative to the moment the timer unit
itself is activated.
and the repetition is done by
OnUnitActiveSec=Defines a timer relative to when the unit the timer
unit is activating was last activated.
Note that for the time spans provided as arguments you can use any of the time units described in
systemd.time man page which means that
is the same as