Config...:Timer(3pm)

🌸 NAME 🌸

  • Config::Model::models::Systemd::Section::Timer β€” the Configuration class Systemd::Section::Timer

so this lil diva comes to you courtesy of the User Contributed Perl Documentation, section 3pm, and she's here to explain how systemd timers get configured through Config::Model. bestie, we're going in πŸ’…


πŸ’– DESCRIPTION πŸ’–

okay so first up, the actual what-even-is-this: these are Configuration classes used by Config::Model ✨

A unit configuration file whose name ends in .timer encodes info about a timer that's controlled and supervised by systemd, for timer-based activation. that's the whole vibe. systemd looks at the clock, systemd pokes a thing. ⏰

This man page lists the configuration options specific to this unit type. For the common options that every unit configuration file shares, go read systemd.unit(5) β€” she's the mothership. The common configuration items are configured in the generic [Unit] and [Install] sections, and the timer specific configuration options are configured in the [Timer] section. πŸŽ€

For each timer file, a matching unit file must exist β€” that's the file describing the unit to activate when the timer elapses. By default, a service by the same name as the timer (except for the suffix) is activated. Example: a timer file "foo.timer" activates a matching service "foo.service". The unit to activate may be controlled by "Unit" (see below). ✨

⚠️ now the part where you need to pay attention, bestie. Note that in case the unit to activate is already active at the time the timer elapses, it is not restarted β€” it's simply left running. There is no concept of spawning new service instances in this case. Because of this, services with "RemainAfterExit=yes" set (which stay around continuously even after the service's main process exited) are usually not suitable for activation via repetitive timers, since they will only be activated once, and then stay around forever. πŸ’€ Target units, which by default do not deactivate on their own, can be activated repeatedly by timers by setting "StopWhenUnneeded=yes" on them. That causes a target unit to be stopped immediately after its activation, if it is not a dependency of another running unit. 🫢

This configuration class was generated from systemd documentation by parse-man.pl β€” https://github.com/dod38fr/config-model-systemd/contrib/parse-man.pl 🌈


✨ Elements ✨

alright, time for the actual options. five of them, and upstream is about to hit you with the exact same paragraph for every single one. I'm not skipping a word of it, I'm just gonna say it in my own voice each time so you don't fall asleep. iykyk πŸ¦‹


🌸 OnActiveSec 🌸

Defines monotonic timers relative to different starting points:

  • Multiple directives may be combined β€” same type or different types β€” and in that case the timer unit will trigger whenever any of the specified timer expressions elapse. For example, by combining "OnBootSec" and "OnUnitActiveSec", it is possible to define a timer that elapses in regular intervals and activates a specific service each time. Moreover, both monotonic time expressions and "OnCalendar" calendar expressions may be combined in the same timer unit. πŸ”₯
  • The arguments to the directives are time spans configured in seconds. Example: "OnBootSec=50" means 50s after boot-up. The argument may also include time units. Example: "OnBootSec=5h 30min" means 5 hours and 30 minutes after boot-up. For details about the syntax of time spans, see systemd.time(7). ⏱️
  • If a timer configured with "OnBootSec" or "OnStartupSec" is already in the past when the timer unit is activated, it will immediately elapse and the configured unit is started. This is not the case for timers defined in the other directives. πŸ‘€
  • These are monotonic timers, independent of wall-clock time and timezones. If the computer is temporarily suspended, the monotonic clock generally pauses, too. Note that if "WakeSystem" is used, a different monotonic clock is selected that continues to advance while the system is suspended and thus can be used as the trigger to resume the system. 😴
  • If the empty string is assigned to any of these options, the list of timers is reset (both monotonic timers and "OnCalendar" timers, see below), and all prior assignments will have no effect. πŸ’€
  • Note that timers do not necessarily expire at the precise time configured with these settings, as they are subject to the "AccuracySec" setting below. πŸ™ˆ
  • Optional. Type uniline.

πŸŽ€ OnBootSec πŸŽ€

Defines monotonic timers relative to different starting points:

  • You can stack multiple directives, of the same type and of different types, and in which case the timer unit will trigger whenever any of the specified timer expressions elapse. Example of that combo life: by combining "OnBootSec" and "OnUnitActiveSec", it is possible to define a timer that elapses in regular intervals and activates a specific service each time. And it gets better β€” both monotonic time expressions and "OnCalendar" calendar expressions may be combined in the same timer unit. πŸ’–
  • The arguments to the directives are time spans configured in seconds. Example: "OnBootSec=50" means 50s after boot-up. The argument may also include time units. Example: "OnBootSec=5h 30min" means 5 hours and 30 minutes after boot-up. For details about the syntax of time spans, see systemd.time(7). πŸ“–
  • Heads up on behaviour: if a timer configured with "OnBootSec" or "OnStartupSec" is already in the past when the timer unit is activated, it will immediately elapse and the configured unit is started. This is not the case for timers defined in the other directives. ✨
  • These are monotonic timers, independent of wall-clock time and timezones. If the computer is temporarily suspended, the monotonic clock generally pauses, too. Note that if "WakeSystem" is used, a different monotonic clock is selected that continues to advance while the system is suspended and thus can be used as the trigger to resume the system. πŸŒ™
  • If the empty string is assigned to any of these options, the list of timers is reset (both monotonic timers and "OnCalendar" timers, see below), and all prior assignments will have no effect. 🚫
  • Note that timers do not necessarily expire at the precise time configured with these settings, as they are subject to the "AccuracySec" setting below. 🫧
  • Optional. Type uniline.

πŸ¦‹ OnStartupSec πŸ¦‹

Defines monotonic timers relative to different starting points:

  • 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 "OnBootSec" and "OnUnitActiveSec", it is possible to define a timer that elapses in regular intervals and activates a specific service each time. Moreover, both monotonic time expressions and "OnCalendar" calendar expressions may be combined in the same timer unit. 🌈
  • The arguments to the directives are time spans configured in seconds. Example: "OnBootSec=50" means 50s after boot-up. The argument may also include time units. Example: "OnBootSec=5h 30min" means 5 hours and 30 minutes after boot-up. For details about the syntax of time spans, see systemd.time(7). πŸ•°οΈ
  • If a timer configured with "OnBootSec" or "OnStartupSec" is already in the past when the timer unit is activated, it will immediately elapse and the configured unit is started. For timers defined in the other directives, this is not the case. ⚑
  • These are monotonic timers, independent of wall-clock time and timezones. If the computer is temporarily suspended, the monotonic clock generally pauses, too. Note that if "WakeSystem" is used, a different monotonic clock is selected that continues to advance while the system is suspended and thus can be used as the trigger to resume the system. πŸ’€
  • Assign the empty string to any of these options and the list of timers is reset (both monotonic timers and "OnCalendar" timers, see below), and all prior assignments will have no effect. 🧹
  • Note that timers do not necessarily expire at the precise time configured with these settings, as they are subject to the "AccuracySec" setting below. πŸ”
  • Optional. Type uniline.

πŸ’œ OnUnitActiveSec πŸ’œ

Defines monotonic timers relative to different starting points:

  • 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 "OnBootSec" and "OnUnitActiveSec", it is possible to define a timer that elapses in regular intervals and activates a specific service each time. Moreover, both monotonic time expressions and "OnCalendar" calendar expressions may be combined in the same timer unit. πŸ‘‘
  • The arguments to the directives are time spans configured in seconds. Example: "OnBootSec=50" means 50s after boot-up. The argument may also include time units. Example: "OnBootSec=5h 30min" means 5 hours and 30 minutes after boot-up. For details about the syntax of time spans, see systemd.time(7). πŸ“
  • If a timer configured with "OnBootSec" or "OnStartupSec" is already in the past when the timer unit is activated, it will immediately elapse and the configured unit is started. This is not the case for timers defined in the other directives. 🎯
  • These are monotonic timers, independent of wall-clock time and timezones. If the computer is temporarily suspended, the monotonic clock generally pauses, too. Note that if "WakeSystem" is used, a different monotonic clock is selected that continues to advance while the system is suspended and thus can be used as the trigger to resume the system. β˜€οΈ
  • If the empty string is assigned to any of these options, the list of timers is reset (both monotonic timers and "OnCalendar" timers, see below), and all prior assignments will have no effect. πŸ«₯
  • Note that timers do not necessarily expire at the precise time configured with these settings, as they are subject to the "AccuracySec" setting below. 🐒
  • Optional. Type uniline.

🧚 OnUnitInactiveSec 🧚

Defines monotonic timers relative to different starting points:

  • 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. Example: by combining "OnBootSec" and "OnUnitActiveSec", it is possible to define a timer that elapses in regular intervals and activates a specific service each time. Moreover, both monotonic time expressions and "OnCalendar" calendar expressions may be combined in the same timer unit. 🌸
  • The arguments to the directives are time spans configured in seconds. Example: "OnBootSec=50" means 50s after boot-up. The argument may also include time units. Example: "OnBootSec=5h 30min" means 5 hours and 30 minutes after boot-up. For details about the syntax of time spans, see systemd.time(7). 🎈
  • If a timer configured with "OnBootSec" or "OnStartupSec" is already in the past when the timer unit is activated, it will immediately elapse and the configured unit is started. This is not the case for timers defined in the other directives. 🌟
  • These are monotonic timers, independent of wall-clock time and timezones. If the computer is temporarily suspended, the monotonic clock generally pauses, too. Note that if "WakeSystem" is used, a different monotonic clock is selected that continues to advance while the system is suspended and thus can be used as the trigger to resume the system. 🫧
  • If the empty string is assigned to any of these options, the list of timers is reset (both monotonic timers and "OnCalendar" timers, see below), and all prior assignments will have no effect. 🎬
psst β€” timers do not necessarily go off at the exact time you set with any of these settings, because AccuracySec down below has opinions. It's a whole thing.

Optional. Type uniline. ✨


🌸 OnCalendar 🌸

Okay bestie, this one is the realtime queen β€” it defines realtime (i.e. wallclock) timers using calendar event expressions. Go read systemd.time(7) for the full syntax tea on calendar event expressions. Other than that, the semantics are basically the same as OnActiveSec and its little friend group.

Heads up tho: timers don't necessarily expire at the precise time configured with this setting, because AccuracySec (below) is always lurking. 🫠

You can specify this more than once, and then the timer unit triggers whenever any of the specified expressions elapse. And yes, you can mix calendar timers and monotonic timers (the ones from above) inside the same timer unit. It's giving versatile.

If the empty string is assigned to any of these options, the list of timers gets reset β€” and that means both OnCalendar timers and monotonic timers (see above) β€” and all prior assignments will have no effect. Gone. Poof. πŸ’€

⚠️ warning babe: calendar timers might trigger at unexpected times if the system's realtime clock isn't set correctly. Specifically, on systems that lack a battery-buffered Realtime Clock (RTC) it might be wise to enable systemd-time-wait-sync.service, so the clock gets adjusted to a network time source before the timer event is set up. Timer units with at least one OnCalendar expression are automatically ordered after time-sync.target, which systemd-time-wait-sync.service is ordered before. The dependency pipeline said slay. 🌈

When a system is temporarily put to sleep (i.e. system suspend or hibernation) the realtime clock does not pause. So when a calendar timer elapses while the system is sleeping, it won't be acted on immediately β€” but once the system is later resumed it will catch up and process all timers that triggered while the system was sleeping. Note that if a calendar timer elapsed more than once while the system was continuously sleeping, the timer will only result in a single service activation. If WakeSystem (see below) is enabled, a calendar time event elapsing while the system is suspended will cause the system to wake up β€” under the condition the system's hardware supports time-triggered wake-up functionality. πŸ”₯

Optional. Type list of uniline.


⏰ AccuracySec ⏰

Specify the accuracy the timer shall elapse with. Defaults to 1min. Basically the timer is scheduled to elapse within a time window: it starts with the time specified in OnCalendar, OnActiveSec, OnBootSec, OnStartupSec, OnUnitActiveSec or OnUnitInactiveSec, and it ends the time configured with AccuracySec later. Within that window, the expiry time gets placed at a host-specific, randomized, but stable position that's synchronized between all local timer units. Why? To optimize power consumption by suppressing unnecessary CPU wake-ups. Iconic energy-saving behaviour, ngl. πŸ”‹

Want the best accuracy? Set this option to 1us. But note the timer is still subject to the timer slack configured via systemd-system.conf(5)'s TimerSlackNSec setting. See prctl(2) for the deets. And to optimize power consumption, make sure to set this value as high as possible and as low as necessary. Balanced. Periodt.

Note that this setting is primarily a power saving option that allows coalescing CPU wake-ups. Do not confuse it with RandomizedDelaySec (see below), which adds a random value to the time the timer shall elapse next β€” and whose purpose is literally the opposite: stretching elapsing of timer events over a longer period to reduce workload spikes. For further details and explanations and how both settings play together, see below. πŸ‘€

Optional. Type uniline.


🎲 RandomizedDelaySec 🎲

Delays the timer by a randomly selected, evenly distributed amount of time between 0 and the specified time value. Defaults to 0, which means no randomized delay gets applied, bestie. Each timer unit will determine this delay randomly before each iteration, unless it's modified with FixedRandomDelay (see below). The delay is added on top of the next determined elapsing time or the service manager's startup time, whichever is later.

This setting is useful to stretch dispatching of similarly configured timer events over a certain time interval, so they don't all fire at the exact same time and cause resource congestion on the local system. Imagine a hundred timers all screaming at once. Not the vibe. 😭

Now the relation to AccuracySec above: that one lets the service manager coalesce timer events within a specified time range to minimize wakeups, while this setting does the opposite β€” it stretches timer events over an interval so it's unlikely they fire simultaneously. If RandomizedDelaySec and AccuracySec are used in conjunction, first the randomized delay is added, and then the result is possibly further shifted to coalesce it with other timer events happening on the system. As mentioned above, AccuracySec defaults to 1 minute and RandomizedDelaySec to 0, thus encouraging coalescing of timer events. In order to optimally stretch timer events over a certain range of time, set AccuracySec=1us and RandomizedDelaySec to some higher value. That combo is chef's kiss. πŸ’…

Optional. Type uniline.


πŸ“Œ FixedRandomDelay πŸ“Œ

Takes a boolean argument. When enabled, the randomized delay specified by RandomizedDelaySec is chosen deterministically, and it remains stable between all firings of the same timer β€” even if the manager is restarted. The delay is derived from the machine ID, the manager's user identifier, and the timer unit's name. This effectively creates a unique fixed offset for each timer, reducing the jitter in firings of an individual timer while still avoiding firing at the same time as other similarly configured timers. So specific. So loyal. 🫢

This setting has an effect only if RandomizedDelaySec is not 0. Defaults to false.

Optional. Type boolean.

  • upstream_default value :
    • no

πŸ¦‹ RandomizedOffsetSec πŸ¦‹

Offsets the timer by a stable, randomly-selected, and evenly distributed amount of time between 0 and the specified time value. Defaults to 0, meaning no such offset shall be applied. The offset is chosen deterministically, and it's derived the same way as FixedRandomDelay (see above). The offset is added on top of the next determined elapsing time. This setting only has an effect on timers configured with OnCalendar, and it can be combined with RandomizedDelaySec.

Much like RandomizedDelaySec, this setting is for distributing timer events so they don't all fire at once. However, this setting is most useful to prevent resource congestion on a remote service, coming from a fleet of similarly-configured clients. And unlike RandomizedDelaySec, this setting applies its offset with no regard to manager startup time. This maintains the periodicity of configured OnCalendar events across manager restarts. Continuity! We love her. ✨

For example, let's say you're running a backup service and have a fleet of laptops that wish to make backups weekly. To distribute load on the backup service, each laptop should randomly pick a weekday to upload its backups. This could be achieved by setting OnCalendar to weekly, and then configuring a RandomizedDelaySec of 5 days with FixedRandomDelay enabled. Let's say that some laptop randomly chooses a delay of 4 days. If this laptop is restarted more often than that, then the timer will literally never fire: on each fresh boot, the 4 day delay is restarted and will not be finished by the time of the next shutdown. Instead, you should use RandomizedOffsetSec, which will maintain the configured weekly cadence of timer events, even across reboots. πŸ™ˆ

Optional. Type uniline.


πŸ” DeferReactivation πŸ”

Takes a boolean argument. When enabled, the timer schedules the next elapse based on the trigger unit entering inactivity, instead of the last trigger time. This is most apparent in the case where the service unit takes longer to run than the timer interval. With this setting enabled, the timer will schedule the next elapse based on when the service finishes running, and so it will have to wait until the next realtime elapse time to trigger. Otherwise, the default behavior is for the timer unit to immediately trigger again once the service finishes running β€” because the timer schedules the next elapse based on the previous trigger time, and since the interval is shorter than the service runtime, that elapse will be in the past, causing it to immediately trigger once done. (Very "it's already late so it's going right now" of it. πŸ’€)

This setting has an effect only if a realtime timer has been specified with OnCalendar. Defaults to false.

Optional. Type boolean.

  • upstream_default value :
    • no

πŸ•°οΈ OnClockChange πŸ•°οΈ

These options take boolean arguments. When true, the service unit will be triggered when the system clock (CLOCK_REALTIME) jumps relative to the monotonic clock (CLOCK_MONOTONIC), or when the local system timezone is modified. These options can be used alone or in combination with other timer expressions (see above) within the same timer unit. These options default to false.

Optional. Type uniline.


🌍 OnTimezoneChange 🌍

These options take boolean arguments. When true, the service unit will be triggered when the system clock (CLOCK_REALTIME) jumps relative to the monotonic clock (CLOCK_MONOTONIC), or when the local system timezone is modified. These options can be used alone or in combination with other timer expressions (see above) within the same timer unit. These options default to false.

Optional. Type uniline.


🎯 Unit 🎯

The unit to activate when this timer elapses. The argument is a unit name, whose suffix is not .timer. If not specified, this value defaults to a service that has the same name as the timer unit, except for the suffix. (See above.) And fr fr, it is recommended that the unit name that is activated and the unit name of the timer unit are named identically, except for the suffix. Matching names? Main character energy. πŸ‘‘

Optional. Type uniline.


πŸ’Ύ Persistent πŸ’Ύ

Takes a boolean argument. If true, the time when the service unit was last triggered is stored on disk. When the timer is activated, the service unit is triggered immediately if it would have been triggered at least once during the time when the timer was inactive. Such triggering is nonetheless subject to the delay imposed by RandomizedDelaySec. This is useful to catch up on missed runs of the service when the system was powered down. Note that this setting only has an effect on timers configured with OnCalendar. Defaults to false.

important bestie: use systemctl clean --what=state … on the timer unit to remove the timestamp file maintained by this option from disk. In particular, use this command before uninstalling a timer unit. See systemctl(1) for details. Don't leave orphan files lying around, it's not cute. 🧚

Optional. Type boolean.

  • upstream_default value :
    • no

✨ WakeSystem ✨

Okay bestie, this one takes a boolean, and if you set it to true, an elapsing timer will literally wake your system up from suspend β€” but only if it's actually suspended and only if your system even supports doing that. πŸ’…

Heads up though: this option only makes sure your system resumes at the right times. It does not handle putting it back to sleep after whatever work needed doing is done. That part is on you, bestie. 😭

Defaults to "false".

Also, this whole thing needs privileges, so realistically it's only available in the system service manager. Iconic but exclusive. πŸ‘‘

And the big one: the behaviour of monotonic clock timers β€” the ones you configure with "OnActiveSec", "OnBootSec", "OnStartupSec", "OnUnitActiveSec", "OnUnitInactiveSec" (see above, you know the drill) β€” gets altered depending on this option. So:

  • If false, it uses a monotonic clock that gets paused during system suspend β€” that's "CLOCK_MONOTONIC".
  • If true, it uses a different monotonic clock that keeps advancing during system suspend β€” that's "CLOCK_BOOTTIME".

See clock_getres(2) for the deets, iykyk. Optional. Type boolean.

upstream_default value:

no

✨ RemainAfterElapse ✨

Takes a boolean argument, standard queen behaviour. If true, a timer will stay loaded, and its state stays queryable even after it already elapsed and the associated unit (configured with "Unit", see above) deactivated again. She's not going anywhere, she's just vibing. πŸ¦‹

If false, then an elapsed timer unit that can't elapse anymore gets unloaded once its associated unit deactivates again. Turning this off is particularly useful for transient timer units, fr fr.

Now, this setting lowkey matters when you start a timer unit over and over:

  • If RemainAfterElapse is on, starting the timer a second time has no effect. Nothing. Nada. 😭
  • But if RemainAfterElapse is off and the timer unit was already unloaded, it can be started again β€” which means the service can get triggered multiple times. Main character energy, honestly. πŸ”₯

Defaults to "true". Optional. Type boolean.

upstream_default value:

yes

🌈 SEE ALSO 🌈

  • cme

2010-2016 Lennart Poettering and others
2016 Dominique Dumont

🫢 LICENSE 🫢

LGPLv2.1+

And that's a wrap, bestie! πŸŽ€ This page came to you from perl v5.40.1, dated 2026-03-22, in true Config...:Timer(3pm) fashion. Go forth and schedule responsibly. βœ¨πŸ’…πŸŒΈ

πŸ“¦ where this page comes from