]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.timer.xml
tmpfiles: fix compilation without acl support
[thirdparty/systemd.git] / man / systemd.timer.xml
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
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
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
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
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>
47 <refpurpose>Timer unit configuration</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <para><filename><replaceable>timer</replaceable>.timer</filename></para>
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para>A unit configuration file whose name ends in
58 <literal>.timer</literal> encodes information about
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
71 <para>For each timer file, a matching unit file must
72 exist, describing the unit to activate when the timer
73 elapses. By default, a service by the same name as the
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>
79
80 <para>Unless <varname>DefaultDependencies=</varname>
81 is set to <option>false</option>, all timer units will
82 implicitly have dependencies of type
83 <varname>Conflicts=</varname> and
84 <varname>Before=</varname> on
85 <filename>shutdown.target</filename> to ensure that
86 they are stopped cleanly prior to system shutdown.
87 Timer units with at least one
88 <varname>OnCalendar=</varname> directive will have an
89 additional <varname>After=</varname> dependency on
90 <filename>timer-sync.target</filename> to avoid
91 being started before the system clock has been
92 correctly set. Only timer units involved with early
93 boot or late system shutdown should disable the
94 <varname>DefaultDependencies=</varname> option.</para>
95 </refsect1>
96
97 <refsect1>
98 <title>Options</title>
99
100 <para>Timer files must include a [Timer] section,
101 which carries information about the timer it
102 defines. The options specific to the [Timer] section
103 of timer units are the following:</para>
104
105 <variablelist class='unit-directives'>
106 <varlistentry>
107 <term><varname>OnActiveSec=</varname></term>
108 <term><varname>OnBootSec=</varname></term>
109 <term><varname>OnStartupSec=</varname></term>
110 <term><varname>OnUnitActiveSec=</varname></term>
111 <term><varname>OnUnitInactiveSec=</varname></term>
112
113 <listitem><para>Defines monotonic timers
114 relative to different starting points:
115 <varname>OnActiveSec=</varname> defines a
116 timer relative to the moment the timer
117 itself is
118 activated. <varname>OnBootSec=</varname>
119 defines a timer relative to when the
120 machine was booted
121 up. <varname>OnStartupSec=</varname>
122 defines a timer relative to when
123 systemd was first
124 started. <varname>OnUnitActiveSec=</varname>
125 defines a timer relative to when the
126 unit the timer is activating was last
127 activated. <varname>OnUnitInactiveSec=</varname>
128 defines a timer relative to when the
129 unit the timer is activating was last
130 deactivated.</para>
131
132 <para>Multiple directives may be
133 combined of the same and of different
134 types. For example, by combining
135 <varname>OnBootSec=</varname> and
136 <varname>OnUnitActiveSec=</varname>, it is
137 possible to define a timer that
138 elapses in regular intervals and
139 activates a specific service each
140 time.</para>
141
142 <para>The arguments to the directives
143 are time spans configured in
144 seconds. Example: "OnBootSec=50" means
145 50s after boot-up. The argument may
146 also include time units. Example:
147 "OnBootSec=5h 30min" means 5 hours and
148 30 minutes after boot-up. For details
149 about the syntax of time spans, see
150 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
151
152 <para>If a timer configured with
153 <varname>OnBootSec=</varname> or
154 <varname>OnStartupSec=</varname> is
155 already in the past when the timer
156 unit is activated, it will immediately
157 elapse and the configured unit is
158 started. This is not the case for
159 timers defined in the other
160 directives.</para>
161
162 <para>These are monotonic timers,
163 independent of wall-clock time and timezones. If the
164 computer is temporarily suspended, the
165 monotonic clock stops too.</para>
166
167 <para>If the empty string is assigned
168 to any of these options, the list of
169 timers is reset, and all prior
170 assignments will have no
171 effect.</para>
172
173 <para>Note that timers do not
174 necessarily expire at the precise
175 time configured with these settings,
176 as they are subject to the
177 <varname>AccuracySec=</varname>
178 setting below.</para></listitem>
179
180 </varlistentry>
181
182 <varlistentry>
183 <term><varname>OnCalendar=</varname></term>
184
185 <listitem><para>Defines realtime
186 (i.e. wallclock) timers with calendar
187 event expressions. See
188 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
189 for more information on the syntax of
190 calendar event expressions. Otherwise,
191 the semantics are similar to
192 <varname>OnActiveSec=</varname> and
193 related settings.</para>
194
195 <para>Note that timers do not
196 necessarily expire at the precise
197 time configured with this setting,
198 as it is subject to the
199 <varname>AccuracySec=</varname>
200 setting below.</para></listitem>
201 </varlistentry>
202
203 <varlistentry>
204 <term><varname>AccuracySec=</varname></term>
205
206 <listitem><para>Specify the accuracy
207 the timer shall elapse with. Defaults
208 to 1min. The timer is scheduled to
209 elapse within a time window starting
210 with the time specified in
211 <varname>OnCalendar=</varname>,
212 <varname>OnActiveSec=</varname>,
213 <varname>OnBootSec=</varname>,
214 <varname>OnStartupSec=</varname>,
215 <varname>OnUnitActiveSec=</varname> or
216 <varname>OnUnitInactiveSec=</varname>
217 and ending the time configured with
218 <varname>AccuracySec=</varname>
219 later. Within this time window, the
220 expiry time will be placed at a
221 host-specific, randomized but stable
222 position that is synchronized between
223 all local timer units. This is done in
224 order to distribute the wake-up time
225 in networked installations, as well as
226 optimizing power consumption to
227 suppress unnecessary CPU wake-ups. To
228 get best accuracy, set this option to
229 1us. Note that the timer is still
230 subject to the timer slack configured
231 via
232 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>'s
233 <varname>TimerSlackNSec=</varname>
234 setting. See
235 <citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
236 for details. To optimize power
237 consumption, make sure to set this
238 value as high as possible and as low
239 as necessary.</para></listitem>
240 </varlistentry>
241 <varlistentry>
242 <term><varname>Unit=</varname></term>
243
244 <listitem><para>The unit to activate
245 when this timer elapses. The argument is a
246 unit name, whose suffix is not
247 <literal>.timer</literal>. If not
248 specified, this value defaults to a
249 service that has the same name as the
250 timer unit, except for the
251 suffix. (See above.) It is recommended
252 that the unit name that is activated
253 and the unit name of the timer unit
254 are named identically, except for the
255 suffix.</para></listitem>
256 </varlistentry>
257
258
259 <varlistentry>
260 <term><varname>Persistent=</varname></term>
261
262 <listitem><para>Takes a boolean
263 argument. If true, the time when the
264 service unit was last triggered is
265 stored on disk. When the timer is
266 activated, the service unit is
267 triggered immediately if it would have
268 been triggered at least once during
269 the time when the timer was inactive.
270 This is useful to catch up on missed
271 runs of the service when the machine
272 was off. Note that this setting only
273 has an effect on timers configured
274 with <varname>OnCalendar=</varname>.
275 </para></listitem>
276 </varlistentry>
277
278 <varlistentry>
279 <term><varname>WakeSystem=</varname></term>
280
281 <listitem><para>Takes a boolean
282 argument. If true, an elapsing timer
283 will cause the system to resume from
284 suspend, should it be suspended and if
285 the system supports this. Note that
286 this option will only make sure the
287 system resumes on the appropriate
288 times, it will not take care of
289 suspending it again after any work
290 that is to be done is
291 finished. Defaults to
292 <varname>false</varname>.</para></listitem>
293 </varlistentry>
294 </variablelist>
295 </refsect1>
296
297 <refsect1>
298 <title>See Also</title>
299 <para>
300 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
301 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
302 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
303 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
304 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
305 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
306 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
307 <citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
308 </para>
309 </refsect1>
310
311 </refentry>