]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.timer.xml
doc: comma placement corrections and word order
[thirdparty/systemd.git] / man / systemd.timer.xml
CommitLineData
11fcc3ab
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5
6<!--
7 This file is part of systemd.
8
9 Copyright 2010 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
11fcc3ab
LP
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 19 Lesser General Public License for more details.
11fcc3ab 20
5430f7f2 21 You should have received a copy of the GNU Lesser General Public License
11fcc3ab
LP
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23-->
24
25<refentry id="systemd.timer">
26 <refentryinfo>
27 <title>systemd.timer</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd.timer</refentrytitle>
42 <manvolnum>5</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd.timer</refname>
34511ca7 47 <refpurpose>Timer unit configuration</refpurpose>
11fcc3ab
LP
48 </refnamediv>
49
50 <refsynopsisdiv>
e670b166 51 <para><filename><replaceable>timer</replaceable>.timer</filename></para>
11fcc3ab
LP
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para>A unit configuration file whose name ends in
479fe882 58 <literal>.timer</literal> encodes information about
11fcc3ab
LP
59 a timer controlled and supervised by systemd, for
60 timer-based activation.</para>
61
62 <para>This man page lists the configuration options
63 specific to this unit type. See
64 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
65 for the common options of all unit configuration
66 files. The common configuration items are configured
67 in the generic [Unit] and [Install] sections. The
68 timer specific configuration options are configured in
69 the [Timer] section.</para>
70
b439c6ee 71 <para>For each timer file, a matching unit file must
11fcc3ab 72 exist, describing the unit to activate when the timer
b439c6ee 73 elapses. By default, a service by the same name as the
11fcc3ab
LP
74 timer (except for the suffix) is activated. Example: a
75 timer file <filename>foo.timer</filename> activates a
76 matching service <filename>foo.service</filename>. The
77 unit to activate may be controlled by
78 <varname>Unit=</varname> (see below).</para>
62adf224
LP
79
80 <para>Unless <varname>DefaultDependencies=</varname>
81 is set to <option>false</option>, timer units will
82 implicitly have dependencies of type
83 <varname>Conflicts=</varname> and
84 <varname>Before=</varname> on
85 <filename>shutdown.target</filename>. These ensure
86 that timer units are stopped cleanly prior to system
87 shutdown. Only timer units involved with early boot or
88 late system shutdown should disable this
89 option.</para>
11fcc3ab
LP
90 </refsect1>
91
92 <refsect1>
93 <title>Options</title>
94
95 <para>Timer files must include a [Timer] section,
96 which carries information about the timer it
97 defines. The options specific to the [Timer] section
98 of timer units are the following:</para>
99
ccc9a4f9 100 <variablelist class='unit-directives'>
11fcc3ab 101 <varlistentry>
03fae018
LP
102 <term><varname>OnActiveSec=</varname></term>
103 <term><varname>OnBootSec=</varname></term>
104 <term><varname>OnStartupSec=</varname></term>
105 <term><varname>OnUnitActiveSec=</varname></term>
106 <term><varname>OnUnitInactiveSec=</varname></term>
11fcc3ab 107
7a529f63 108 <listitem><para>Defines monotonic timers
11fcc3ab 109 relative to different starting points:
03fae018 110 <varname>OnActiveSec=</varname> defines a
11fcc3ab
LP
111 timer relative to the moment the timer
112 itself is
03fae018 113 activated. <varname>OnBootSec=</varname>
11fcc3ab
LP
114 defines a timer relative to when the
115 machine was booted
03fae018 116 up. <varname>OnStartupSec=</varname>
11fcc3ab 117 defines a timer relative to when
74051b9b 118 systemd was first
03fae018 119 started. <varname>OnUnitActiveSec=</varname>
11fcc3ab
LP
120 defines a timer relative to when the
121 unit the timer is activating was last
03fae018 122 activated. <varname>OnUnitInactiveSec=</varname>
11fcc3ab
LP
123 defines a timer relative to when the
124 unit the timer is activating was last
125 deactivated.</para>
126
127 <para>Multiple directives may be
b439c6ee 128 combined of the same and of different
11fcc3ab 129 types. For example, by combining
03fae018 130 <varname>OnBootSec=</varname> and
79640424 131 <varname>OnUnitActiveSec=</varname>, it is
11fcc3ab
LP
132 possible to define a timer that
133 elapses in regular intervals and
134 activates a specific service each
135 time.</para>
136
137 <para>The arguments to the directives
138 are time spans configured in
03fae018 139 seconds. Example: "OnBootSec=50" means
11fcc3ab
LP
140 50s after boot-up. The argument may
141 also include time units. Example:
7a529f63
LP
142 "OnBootSec=5h 30min" means 5 hours and
143 30 minutes after boot-up. For details
b040723e 144 about the syntax of time spans, see
11fcc3ab
LP
145 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
146
147 <para>If a timer configured with
03fae018
LP
148 <varname>OnBootSec=</varname> or
149 <varname>OnStartupSec=</varname> is
11fcc3ab
LP
150 already in the past when the timer
151 unit is activated, it will immediately
152 elapse and the configured unit is
153 started. This is not the case for
154 timers defined in the other
7a529f63 155 directives.</para>
11fcc3ab
LP
156
157 <para>These are monotonic timers,
b439c6ee 158 independent of wall-clock time and timezones. If the
11fcc3ab 159 computer is temporarily suspended, the
74051b9b
LP
160 monotonic clock stops too.</para>
161
162 <para>If the empty string is assigned
e9dd9f95 163 to any of these options, the list of
74051b9b
LP
164 timers is reset, and all prior
165 assignments will have no
9f5eb56a
LP
166 effect.</para>
167
e0e009c0
JE
168 <para>Note that timers do not
169 necessarily expire at the precise
9f5eb56a
LP
170 time configured with these settings,
171 as they are subject to the
172 <varname>AccuracySec=</varname>
173 setting below.</para></listitem>
11fcc3ab
LP
174
175 </varlistentry>
7a529f63
LP
176
177 <varlistentry>
178 <term><varname>OnCalendar=</varname></term>
179
180 <listitem><para>Defines realtime
9f5eb56a 181 (i.e. wallclock) timers with calendar
7a529f63
LP
182 event expressions. See
183 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
184 for more information on the syntax of
b040723e 185 calendar event expressions. Otherwise,
74051b9b
LP
186 the semantics are similar to
187 <varname>OnActiveSec=</varname> and
9f5eb56a
LP
188 related settings.</para>
189
e0e009c0
JE
190 <para>Note that timers do not
191 necessarily expire at the precise
9f5eb56a
LP
192 time configured with this setting,
193 as it is subject to the
194 <varname>AccuracySec=</varname>
195 setting below.</para></listitem>
7a529f63
LP
196 </varlistentry>
197
9f5eb56a
LP
198 <varlistentry>
199 <term><varname>AccuracySec=</varname></term>
200
201 <listitem><para>Specify the accuracy
202 the timer shall elapse with. Defaults
203 to 1min. The timer is scheduled to
e0e009c0 204 elapse within a time window starting
9f5eb56a
LP
205 with the time specified in
206 <varname>OnCalendar=</varname>,
207 <varname>OnActiveSec=</varname>,
208 <varname>OnBootSec=</varname>,
209 <varname>OnStartupSec=</varname>,
210 <varname>OnUnitActiveSec=</varname> or
211 <varname>OnUnitInactiveSec=</varname>
212 and ending the time configured with
213 <varname>AccuracySec=</varname>
b040723e 214 later. Within this time window, the
9f5eb56a
LP
215 expiry time will be placed at a
216 host-specific, randomized but stable
73e231ab 217 position that is synchronized between
9f5eb56a
LP
218 all local timer units. This is done in
219 order to distribute the wake-up time
220 in networked installations, as well as
221 optimizing power consumption to
222 suppress unnecessary CPU wake-ups. To
b040723e 223 get best accuracy, set this option to
9f5eb56a
LP
224 1us. Note that the timer is still
225 subject to the timer slack configured
226 via
227 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>'s
228 <varname>TimerSlackNSec=</varname>
229 setting. See
230 <citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
231 for details. To optimize power
b040723e 232 consumption, make sure to set this
9f5eb56a
LP
233 value as high as possible and as low
234 as necessary.</para></listitem>
235 </varlistentry>
11fcc3ab
LP
236 <varlistentry>
237 <term><varname>Unit=</varname></term>
238
239 <listitem><para>The unit to activate
b36b082c 240 when this timer elapses. The argument is a
11fcc3ab 241 unit name, whose suffix is not
479fe882 242 <literal>.timer</literal>. If not
b439c6ee 243 specified, this value defaults to a
11fcc3ab
LP
244 service that has the same name as the
245 timer unit, except for the
ad678a06 246 suffix. (See above.) It is recommended
11fcc3ab
LP
247 that the unit name that is activated
248 and the unit name of the timer unit
ad678a06 249 are named identically, except for the
11fcc3ab
LP
250 suffix.</para></listitem>
251 </varlistentry>
06642d17
LP
252
253
254 <varlistentry>
255 <term><varname>Persistent=</varname></term>
256
257 <listitem><para>Takes a boolean
de41590a
ZJS
258 argument. If true, the time when the
259 service unit was last triggered is
260 stored on disk. When the timer is
261 activated, the service unit is
262 triggered immediately if it would have
263 been triggered at least once during
264 the time when the timer was inactive.
265 This is useful to catch up on missed
266 runs of the service when the machine
267 was off. Note that this setting only
268 has an effect on timers configured
269 with <varname>OnCalendar=</varname>.
06642d17
LP
270 </para></listitem>
271 </varlistentry>
dedabea4
LP
272
273 <varlistentry>
274 <term><varname>WakeSystem=</varname></term>
275
276 <listitem><para>Takes a boolean
b8bde116 277 argument. If true, an elapsing timer
dedabea4
LP
278 will cause the system to resume from
279 suspend, should it be suspended and if
280 the system supports this. Note that
281 this option will only make sure the
282 system resumes on the appropriate
283 times, it will not take care of
284 suspending it again after any work
285 that is to be done is
286 finished. Defaults to
287 <varname>false</varname>.</para></listitem>
288 </varlistentry>
11fcc3ab
LP
289 </variablelist>
290 </refsect1>
291
292 <refsect1>
293 <title>See Also</title>
294 <para>
f3e219a2 295 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
11fcc3ab
LP
296 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
297 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
7a529f63 298 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
9cc2c8b7 299 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
9f5eb56a
LP
300 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
301 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
302 <citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
11fcc3ab
LP
303 </para>
304 </refsect1>
305
306</refentry>