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