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

IMPLICIT DEPENDENCIES

37       The following dependencies are implicitly added:
38
39       ·   Timer units automatically gain a Before= dependency on the service
40           they are supposed to activate.
41

AUTOMATIC DEPENDENCIES

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

OPTIONS

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

SEE ALSO

193       systemd(1), systemctl(1), systemd.unit(5), systemd.service(5),
194       systemd.time(7), systemd.directives(7), systemd-system.conf(5),
195       prctl(2)
196
197
198
199systemd 239                                                   SYSTEMD.TIMER(5)
Impressum