]>
Commit | Line | Data |
---|---|---|
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> | |
19f8d037 | 81 | is set to <option>false</option>, all timer units will |
62adf224 LP |
82 | implicitly have dependencies of type |
83 | <varname>Conflicts=</varname> and | |
84 | <varname>Before=</varname> on | |
19f8d037 TGR |
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> | |
11fcc3ab LP |
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 | ||
ccc9a4f9 | 105 | <variablelist class='unit-directives'> |
11fcc3ab | 106 | <varlistentry> |
03fae018 LP |
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> | |
11fcc3ab | 112 | |
7a529f63 | 113 | <listitem><para>Defines monotonic timers |
11fcc3ab | 114 | relative to different starting points: |
03fae018 | 115 | <varname>OnActiveSec=</varname> defines a |
11fcc3ab LP |
116 | timer relative to the moment the timer |
117 | itself is | |
03fae018 | 118 | activated. <varname>OnBootSec=</varname> |
11fcc3ab LP |
119 | defines a timer relative to when the |
120 | machine was booted | |
03fae018 | 121 | up. <varname>OnStartupSec=</varname> |
11fcc3ab | 122 | defines a timer relative to when |
74051b9b | 123 | systemd was first |
03fae018 | 124 | started. <varname>OnUnitActiveSec=</varname> |
11fcc3ab LP |
125 | defines a timer relative to when the |
126 | unit the timer is activating was last | |
03fae018 | 127 | activated. <varname>OnUnitInactiveSec=</varname> |
11fcc3ab LP |
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 | |
b439c6ee | 133 | combined of the same and of different |
11fcc3ab | 134 | types. For example, by combining |
03fae018 | 135 | <varname>OnBootSec=</varname> and |
79640424 | 136 | <varname>OnUnitActiveSec=</varname>, it is |
11fcc3ab LP |
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 | |
03fae018 | 144 | seconds. Example: "OnBootSec=50" means |
11fcc3ab LP |
145 | 50s after boot-up. The argument may |
146 | also include time units. Example: | |
7a529f63 LP |
147 | "OnBootSec=5h 30min" means 5 hours and |
148 | 30 minutes after boot-up. For details | |
b040723e | 149 | about the syntax of time spans, see |
11fcc3ab LP |
150 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
151 | ||
152 | <para>If a timer configured with | |
03fae018 LP |
153 | <varname>OnBootSec=</varname> or |
154 | <varname>OnStartupSec=</varname> is | |
11fcc3ab LP |
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 | |
7a529f63 | 160 | directives.</para> |
11fcc3ab LP |
161 | |
162 | <para>These are monotonic timers, | |
b439c6ee | 163 | independent of wall-clock time and timezones. If the |
11fcc3ab | 164 | computer is temporarily suspended, the |
74051b9b LP |
165 | monotonic clock stops too.</para> |
166 | ||
167 | <para>If the empty string is assigned | |
e9dd9f95 | 168 | to any of these options, the list of |
74051b9b LP |
169 | timers is reset, and all prior |
170 | assignments will have no | |
9f5eb56a LP |
171 | effect.</para> |
172 | ||
e0e009c0 JE |
173 | <para>Note that timers do not |
174 | necessarily expire at the precise | |
9f5eb56a LP |
175 | time configured with these settings, |
176 | as they are subject to the | |
177 | <varname>AccuracySec=</varname> | |
178 | setting below.</para></listitem> | |
11fcc3ab LP |
179 | |
180 | </varlistentry> | |
7a529f63 LP |
181 | |
182 | <varlistentry> | |
183 | <term><varname>OnCalendar=</varname></term> | |
184 | ||
185 | <listitem><para>Defines realtime | |
9f5eb56a | 186 | (i.e. wallclock) timers with calendar |
7a529f63 LP |
187 | event expressions. See |
188 | <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
189 | for more information on the syntax of | |
b040723e | 190 | calendar event expressions. Otherwise, |
74051b9b LP |
191 | the semantics are similar to |
192 | <varname>OnActiveSec=</varname> and | |
9f5eb56a LP |
193 | related settings.</para> |
194 | ||
e0e009c0 JE |
195 | <para>Note that timers do not |
196 | necessarily expire at the precise | |
9f5eb56a LP |
197 | time configured with this setting, |
198 | as it is subject to the | |
199 | <varname>AccuracySec=</varname> | |
200 | setting below.</para></listitem> | |
7a529f63 LP |
201 | </varlistentry> |
202 | ||
9f5eb56a LP |
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 | |
e0e009c0 | 209 | elapse within a time window starting |
9f5eb56a LP |
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> | |
b040723e | 219 | later. Within this time window, the |
9f5eb56a LP |
220 | expiry time will be placed at a |
221 | host-specific, randomized but stable | |
73e231ab | 222 | position that is synchronized between |
9f5eb56a LP |
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 | |
b040723e | 228 | get best accuracy, set this option to |
9f5eb56a LP |
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 | |
b040723e | 237 | consumption, make sure to set this |
9f5eb56a LP |
238 | value as high as possible and as low |
239 | as necessary.</para></listitem> | |
240 | </varlistentry> | |
11fcc3ab LP |
241 | <varlistentry> |
242 | <term><varname>Unit=</varname></term> | |
243 | ||
244 | <listitem><para>The unit to activate | |
b36b082c | 245 | when this timer elapses. The argument is a |
11fcc3ab | 246 | unit name, whose suffix is not |
479fe882 | 247 | <literal>.timer</literal>. If not |
b439c6ee | 248 | specified, this value defaults to a |
11fcc3ab LP |
249 | service that has the same name as the |
250 | timer unit, except for the | |
ad678a06 | 251 | suffix. (See above.) It is recommended |
11fcc3ab LP |
252 | that the unit name that is activated |
253 | and the unit name of the timer unit | |
ad678a06 | 254 | are named identically, except for the |
11fcc3ab LP |
255 | suffix.</para></listitem> |
256 | </varlistentry> | |
06642d17 LP |
257 | |
258 | ||
259 | <varlistentry> | |
260 | <term><varname>Persistent=</varname></term> | |
261 | ||
262 | <listitem><para>Takes a boolean | |
de41590a ZJS |
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>. | |
06642d17 LP |
275 | </para></listitem> |
276 | </varlistentry> | |
dedabea4 LP |
277 | |
278 | <varlistentry> | |
279 | <term><varname>WakeSystem=</varname></term> | |
280 | ||
281 | <listitem><para>Takes a boolean | |
b8bde116 | 282 | argument. If true, an elapsing timer |
dedabea4 LP |
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> | |
11fcc3ab LP |
294 | </variablelist> |
295 | </refsect1> | |
296 | ||
297 | <refsect1> | |
298 | <title>See Also</title> | |
299 | <para> | |
f3e219a2 | 300 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
67826132 | 301 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
11fcc3ab | 302 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
7a529f63 | 303 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
9cc2c8b7 | 304 | <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
9f5eb56a LP |
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> | |
11fcc3ab LP |
308 | </para> |
309 | </refsect1> | |
310 | ||
311 | </refentry> |