1SYSTEMD.TIMER(5)                 systemd.timer                SYSTEMD.TIMER(5)
2
3
4

NAME

6       systemd.timer - Timer unit configuration
7

SYNOPSIS

9       timer.timer
10

DESCRIPTION

12       A unit configuration file whose name ends in ".timer" encodes
13       information about a timer controlled and supervised by systemd, for
14       timer-based activation.
15
16       This man page lists the configuration options specific to this unit
17       type. See systemd.unit(5) for the common options of all unit
18       configuration files. The common configuration items are configured in
19       the generic [Unit] and [Install] sections. The timer specific
20       configuration options are configured in the [Timer] section.
21
22       For each timer file, a matching unit file must exist, describing the
23       unit to activate when the timer elapses. By default, a service by the
24       same name as the timer (except for the suffix) is activated. Example: a
25       timer file foo.timer activates a matching service foo.service. The unit
26       to activate may be controlled by Unit= (see below).
27
28       Note that in case the unit to activate is already active at the time
29       the timer elapses it is not restarted, but simply left running. There
30       is no concept of spawning new service instances in this case. Due to
31       this, services with RemainAfterExit= set (which stay around
32       continuously even after the service's main process exited) are usually
33       not suitable for activation via repetitive timers, as they will only be
34       activated once, and then stay around forever.
35

AUTOMATIC DEPENDENCIES

37   Implicit Dependencies
38       The following dependencies are implicitly added:
39
40       ·   Timer units automatically gain a Before= dependency on the service
41           they are supposed to activate.
42
43   Default Dependencies
44       The following dependencies are added unless DefaultDependencies=no is
45       set:
46
47       ·   Timer units will automatically have dependencies of type Requires=
48           and After= on sysinit.target, a dependency of type Before= on
49           timers.target, as well as Conflicts= and Before= on shutdown.target
50           to ensure that they are stopped cleanly prior to system shutdown.
51           Only timer units involved with early boot or late system shutdown
52           should disable the DefaultDependencies= option.
53
54       ·   Timer units with at least one OnCalendar= directive will have an
55           additional After= dependency on time-sync.target to avoid being
56           started before the system clock has been correctly set.
57

OPTIONS

59       Timer files must include a [Timer] section, which carries information
60       about the timer it defines. The options specific to the [Timer] section
61       of timer units are the following:
62
63       OnActiveSec=, OnBootSec=, OnStartupSec=, OnUnitActiveSec=,
64       OnUnitInactiveSec=
65           Defines monotonic timers relative to different starting points:
66           OnActiveSec= defines a timer relative to the moment the timer
67           itself is activated.  OnBootSec= defines a timer relative to when
68           the machine was booted up.  OnStartupSec= defines a timer relative
69           to when systemd was first started.  OnUnitActiveSec= defines a
70           timer relative to when the unit the timer is activating was last
71           activated.  OnUnitInactiveSec= defines a timer relative to when the
72           unit the timer is activating was last deactivated.
73
74           Multiple directives may be combined of the same and of different
75           types. For example, by combining OnBootSec= and OnUnitActiveSec=,
76           it is possible to define a timer that elapses in regular intervals
77           and activates a specific service each time.
78
79           The arguments to the directives are time spans configured in
80           seconds. Example: "OnBootSec=50" means 50s after boot-up. The
81           argument may also include time units. Example: "OnBootSec=5h 30min"
82           means 5 hours and 30 minutes after boot-up. For details about the
83           syntax of time spans, see systemd.time(7).
84
85           If a timer configured with OnBootSec= or OnStartupSec= is already
86           in the past when the timer unit is activated, it will immediately
87           elapse and the configured unit is started. This is not the case for
88           timers defined in the other directives.
89
90           These are monotonic timers, independent of wall-clock time and
91           timezones. If the computer is temporarily suspended, the monotonic
92           clock stops too.
93
94           If the empty string is assigned to any of these options, the list
95           of timers is reset, and all prior assignments will have no effect.
96
97           Note that timers do not necessarily expire at the precise time
98           configured with these settings, as they are subject to the
99           AccuracySec= setting below.
100
101       OnCalendar=
102           Defines realtime (i.e. wallclock) timers with calendar event
103           expressions. See systemd.time(7) for more information on the syntax
104           of calendar event expressions. Otherwise, the semantics are similar
105           to OnActiveSec= and related settings.
106
107           Note that timers do not necessarily expire at the precise time
108           configured with this setting, as it is subject to the AccuracySec=
109           setting below.
110
111           May be specified more than once.
112
113       AccuracySec=
114           Specify the accuracy the timer shall elapse with. Defaults to 1min.
115           The timer is scheduled to elapse within a time window starting with
116           the time specified in OnCalendar=, OnActiveSec=, OnBootSec=,
117           OnStartupSec=, OnUnitActiveSec= or OnUnitInactiveSec= and ending
118           the time configured with AccuracySec= later. Within this time
119           window, the expiry time will be placed at a host-specific,
120           randomized, but stable position that is synchronized between all
121           local timer units. This is done in order to optimize power
122           consumption to suppress unnecessary CPU wake-ups. To get best
123           accuracy, set this option to 1us. Note that the timer is still
124           subject to the timer slack configured via systemd-system.conf(5)'s
125           TimerSlackNSec= setting. See prctl(2) for details. To optimize
126           power consumption, make sure to set this value as high as possible
127           and as low as necessary.
128
129       RandomizedDelaySec=
130           Delay the timer by a randomly selected, evenly distributed amount
131           of time between 0 and the specified time value. Defaults to 0,
132           indicating that no randomized delay shall be applied. Each timer
133           unit will determine this delay randomly before each iteration, and
134           the delay will simply be added on top of the next determined
135           elapsing time. This is useful to stretch dispatching of similarly
136           configured timer events over a certain amount time, to avoid that
137           they all fire at the same time, possibly resulting in resource
138           congestion. Note the relation to AccuracySec= above: the latter
139           allows the service manager to coalesce timer events within a
140           specified time range in order to minimize wakeups, the former does
141           the opposite: it stretches timer events over a time range, to make
142           it unlikely that they fire simultaneously. If RandomizedDelaySec=
143           and AccuracySec= are used in conjunction, first the randomized
144           delay is added, and then the result is possibly further shifted to
145           coalesce it with other timer events happening on the system. As
146           mentioned above AccuracySec= defaults to 1min and
147           RandomizedDelaySec= to 0, thus encouraging coalescing of timer
148           events. In order to optimally stretch timer events over a certain
149           range of time, make sure to set RandomizedDelaySec= to a higher
150           value, and AccuracySec=1us.
151
152       Unit=
153           The unit to activate when this timer elapses. The argument is a
154           unit name, whose suffix is not ".timer". If not specified, this
155           value defaults to a service that has the same name as the timer
156           unit, except for the suffix. (See above.) It is recommended that
157           the unit name that is activated and the unit name of the timer unit
158           are named identically, except for the suffix.
159
160       Persistent=
161           Takes a boolean argument. If true, the time when the service unit
162           was last triggered is stored on disk. When the timer is activated,
163           the service unit is triggered immediately if it would have been
164           triggered at least once during the time when the timer was
165           inactive. This is useful to catch up on missed runs of the service
166           when the machine was off. Note that this setting only has an effect
167           on timers configured with OnCalendar=. Defaults to false.
168
169       WakeSystem=
170           Takes a boolean argument. If true, an elapsing timer will cause the
171           system to resume from suspend, should it be suspended and if the
172           system supports this. Note that this option will only make sure the
173           system resumes on the appropriate times, it will not take care of
174           suspending it again after any work that is to be done is finished.
175           Defaults to false.
176
177       RemainAfterElapse=
178           Takes a boolean argument. If true, an elapsed timer will stay
179           loaded, and its state remains queriable. If false, an elapsed timer
180           unit that cannot elapse anymore is unloaded. Turning this off is
181           particularly useful for transient timer units that shall disappear
182           after they first elapse. Note that this setting has an effect on
183           repeatedly starting a timer unit that only elapses once: if
184           RemainAfterElapse= is on, it will not be started again, and is
185           guaranteed to elapse only once. However, if RemainAfterElapse= is
186           off, it might be started again if it is already elapsed, and thus
187           be triggered multiple times. Defaults to yes.
188

SEE ALSO

190       systemd(1), systemctl(1), systemd.unit(5), systemd.service(5),
191       systemd.time(7), systemd.directives(7), systemd-system.conf(5),
192       prctl(2)
193
194
195
196systemd 241                                                   SYSTEMD.TIMER(5)
Impressum