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