]> git.proxmox.com Git - systemd.git/blob - man/systemd.timer.html
Imported Upstream version 218
[systemd.git] / man / systemd.timer.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd.timer</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 218</span><hr><div class="refentry"><a name="systemd.timer"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd.timer — Timer unit configuration</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><p><code class="filename"><em class="replaceable"><code>timer</code></em>.timer</code></p></div><div class="refsect1"><a name="idm140414250923440"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p>A unit configuration file whose name ends in
23 "<code class="literal">.timer</code>" encodes information about
24 a timer controlled and supervised by systemd, for
25 timer-based activation.</p><p>This man page lists the configuration options
26 specific to this unit type. See
27 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>
28 for the common options of all unit configuration
29 files. The common configuration items are configured
30 in the generic [Unit] and [Install] sections. The
31 timer specific configuration options are configured in
32 the [Timer] section.</p><p>For each timer file, a matching unit file must
33 exist, describing the unit to activate when the timer
34 elapses. By default, a service by the same name as the
35 timer (except for the suffix) is activated. Example: a
36 timer file <code class="filename">foo.timer</code> activates a
37 matching service <code class="filename">foo.service</code>. The
38 unit to activate may be controlled by
39 <code class="varname">Unit=</code> (see below).</p><p>Unless <code class="varname">DefaultDependencies=</code>
40 is set to <code class="option">false</code>, all timer units will
41 implicitly have dependencies of type
42 <code class="varname">Conflicts=</code> and
43 <code class="varname">Before=</code> on
44 <code class="filename">shutdown.target</code> to ensure that
45 they are stopped cleanly prior to system shutdown.
46 Timer units with at least one
47 <code class="varname">OnCalendar=</code> directive will have an
48 additional <code class="varname">After=</code> dependency on
49 <code class="filename">timer-sync.target</code> to avoid
50 being started before the system clock has been
51 correctly set. Only timer units involved with early
52 boot or late system shutdown should disable the
53 <code class="varname">DefaultDependencies=</code> option.</p></div><div class="refsect1"><a name="idm140414250789840"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options"></a></h2><p>Timer files must include a [Timer] section,
54 which carries information about the timer it
55 defines. The options specific to the [Timer] section
56 of timer units are the following:</p><div class="variablelist"><dl class="variablelist"><dt id="OnActiveSec="><span class="term"><code class="varname">OnActiveSec=</code>, </span><span class="term"><code class="varname">OnBootSec=</code>, </span><span class="term"><code class="varname">OnStartupSec=</code>, </span><span class="term"><code class="varname">OnUnitActiveSec=</code>, </span><span class="term"><code class="varname">OnUnitInactiveSec=</code></span><a class="headerlink" title="Permalink to this term" href="#OnActiveSec="></a></dt><dd><p>Defines monotonic timers
57 relative to different starting points:
58 <code class="varname">OnActiveSec=</code> defines a
59 timer relative to the moment the timer
60 itself is
61 activated. <code class="varname">OnBootSec=</code>
62 defines a timer relative to when the
63 machine was booted
64 up. <code class="varname">OnStartupSec=</code>
65 defines a timer relative to when
66 systemd was first
67 started. <code class="varname">OnUnitActiveSec=</code>
68 defines a timer relative to when the
69 unit the timer is activating was last
70 activated. <code class="varname">OnUnitInactiveSec=</code>
71 defines a timer relative to when the
72 unit the timer is activating was last
73 deactivated.</p><p>Multiple directives may be
74 combined of the same and of different
75 types. For example, by combining
76 <code class="varname">OnBootSec=</code> and
77 <code class="varname">OnUnitActiveSec=</code>, it is
78 possible to define a timer that
79 elapses in regular intervals and
80 activates a specific service each
81 time.</p><p>The arguments to the directives
82 are time spans configured in
83 seconds. Example: "OnBootSec=50" means
84 50s after boot-up. The argument may
85 also include time units. Example:
86 "OnBootSec=5h 30min" means 5 hours and
87 30 minutes after boot-up. For details
88 about the syntax of time spans, see
89 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>.</p><p>If a timer configured with
90 <code class="varname">OnBootSec=</code> or
91 <code class="varname">OnStartupSec=</code> is
92 already in the past when the timer
93 unit is activated, it will immediately
94 elapse and the configured unit is
95 started. This is not the case for
96 timers defined in the other
97 directives.</p><p>These are monotonic timers,
98 independent of wall-clock time and timezones. If the
99 computer is temporarily suspended, the
100 monotonic clock stops too.</p><p>If the empty string is assigned
101 to any of these options, the list of
102 timers is reset, and all prior
103 assignments will have no
104 effect.</p><p>Note that timers do not
105 necessarily expire at the precise
106 time configured with these settings,
107 as they are subject to the
108 <code class="varname">AccuracySec=</code>
109 setting below.</p></dd><dt id="OnCalendar="><span class="term"><code class="varname">OnCalendar=</code></span><a class="headerlink" title="Permalink to this term" href="#OnCalendar="></a></dt><dd><p>Defines realtime
110 (i.e. wallclock) timers with calendar
111 event expressions. See
112 <a href="systemd.time.html"><span class="citerefentry"><span class="refentrytitle">systemd.time</span>(7)</span></a>
113 for more information on the syntax of
114 calendar event expressions. Otherwise,
115 the semantics are similar to
116 <code class="varname">OnActiveSec=</code> and
117 related settings.</p><p>Note that timers do not
118 necessarily expire at the precise
119 time configured with this setting,
120 as it is subject to the
121 <code class="varname">AccuracySec=</code>
122 setting below.</p></dd><dt id="AccuracySec="><span class="term"><code class="varname">AccuracySec=</code></span><a class="headerlink" title="Permalink to this term" href="#AccuracySec="></a></dt><dd><p>Specify the accuracy
123 the timer shall elapse with. Defaults
124 to 1min. The timer is scheduled to
125 elapse within a time window starting
126 with the time specified in
127 <code class="varname">OnCalendar=</code>,
128 <code class="varname">OnActiveSec=</code>,
129 <code class="varname">OnBootSec=</code>,
130 <code class="varname">OnStartupSec=</code>,
131 <code class="varname">OnUnitActiveSec=</code> or
132 <code class="varname">OnUnitInactiveSec=</code>
133 and ending the time configured with
134 <code class="varname">AccuracySec=</code>
135 later. Within this time window, the
136 expiry time will be placed at a
137 host-specific, randomized but stable
138 position that is synchronized between
139 all local timer units. This is done in
140 order to distribute the wake-up time
141 in networked installations, as well as
142 optimizing power consumption to
143 suppress unnecessary CPU wake-ups. To
144 get best accuracy, set this option to
145 1us. Note that the timer is still
146 subject to the timer slack configured
147 via
148 <a href="systemd-system.conf.html"><span class="citerefentry"><span class="refentrytitle">systemd-system.conf</span>(5)</span></a>'s
149 <code class="varname">TimerSlackNSec=</code>
150 setting. See
151 <a href="http://man7.org/linux/man-pages/man2/prctl.2.html"><span class="citerefentry"><span class="refentrytitle">prctl</span>(2)</span></a>
152 for details. To optimize power
153 consumption, make sure to set this
154 value as high as possible and as low
155 as necessary.</p></dd><dt id="Unit="><span class="term"><code class="varname">Unit=</code></span><a class="headerlink" title="Permalink to this term" href="#Unit="></a></dt><dd><p>The unit to activate
156 when this timer elapses. The argument is a
157 unit name, whose suffix is not
158 "<code class="literal">.timer</code>". If not
159 specified, this value defaults to a
160 service that has the same name as the
161 timer unit, except for the
162 suffix. (See above.) It is recommended
163 that the unit name that is activated
164 and the unit name of the timer unit
165 are named identically, except for the
166 suffix.</p></dd><dt id="Persistent="><span class="term"><code class="varname">Persistent=</code></span><a class="headerlink" title="Permalink to this term" href="#Persistent="></a></dt><dd><p>Takes a boolean
167 argument. If true, the time when the
168 service unit was last triggered is
169 stored on disk. When the timer is
170 activated, the service unit is
171 triggered immediately if it would have
172 been triggered at least once during
173 the time when the timer was inactive.
174 This is useful to catch up on missed
175 runs of the service when the machine
176 was off. Note that this setting only
177 has an effect on timers configured
178 with <code class="varname">OnCalendar=</code>.
179 </p></dd><dt id="WakeSystem="><span class="term"><code class="varname">WakeSystem=</code></span><a class="headerlink" title="Permalink to this term" href="#WakeSystem="></a></dt><dd><p>Takes a boolean
180 argument. If true, an elapsing timer
181 will cause the system to resume from
182 suspend, should it be suspended and if
183 the system supports this. Note that
184 this option will only make sure the
185 system resumes on the appropriate
186 times, it will not take care of
187 suspending it again after any work
188 that is to be done is
189 finished. Defaults to
190 <code class="varname">false</code>.</p></dd></dl></div></div><div class="refsect1"><a name="idm140414250943152"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
191 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
192 <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
193 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>,
194 <a href="systemd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span></a>,
195 <a href="systemd.time.html"><span class="citerefentry"><span class="refentrytitle">systemd.time</span>(7)</span></a>,
196 <a href="systemd.directives.html"><span class="citerefentry"><span class="refentrytitle">systemd.directives</span>(7)</span></a>,
197 <a href="systemd-system.conf.html"><span class="citerefentry"><span class="refentrytitle">systemd-system.conf</span>(5)</span></a>,
198 <a href="http://man7.org/linux/man-pages/man2/prctl.2.html"><span class="citerefentry"><span class="refentrytitle">prctl</span>(2)</span></a>
199 </p></div></div></body></html>