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">
7 This file is part of systemd.
9 Copyright 2010 Lennart Poettering
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.
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.
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/>.
25 <refentry id="systemd.timer">
27 <title>systemd.timer</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemd.timer</refentrytitle>
42 <manvolnum>5</manvolnum>
46 <refname>systemd.timer</refname>
47 <refpurpose>Timer unit configuration</refpurpose>
51 <para><filename><replaceable>timer</replaceable>.timer</filename></para>
55 <title>Description</title>
57 <para>A unit configuration file whose name ends in
58 <filename>.timer</filename> encodes information about
59 a timer controlled and supervised by systemd, for
60 timer-based activation.</para>
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>
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>
80 <para>Unless <varname>DefaultDependencies=</varname>
81 is set to <option>false</option>, timer units will
82 implicitly have dependencies of type
83 <varname>Conflicts=</varname> and
84 <varname>Before=</varname> on
85 <filename>shutdown.target</filename>. These ensure
86 that timer units are stopped cleanly prior to system
87 shutdown. Only timer units involved with early boot or
88 late system shutdown should disable this
93 <title>Options</title>
95 <para>Timer files must include a [Timer] section,
96 which carries information about the timer it
97 defines. The options specific to the [Timer] section
98 of timer units are the following:</para>
100 <variablelist class='unit-directives'>
102 <term><varname>OnActiveSec=</varname></term>
103 <term><varname>OnBootSec=</varname></term>
104 <term><varname>OnStartupSec=</varname></term>
105 <term><varname>OnUnitActiveSec=</varname></term>
106 <term><varname>OnUnitInactiveSec=</varname></term>
108 <listitem><para>Defines monotonic timers
109 relative to different starting points:
110 <varname>OnActiveSec=</varname> defines a
111 timer relative to the moment the timer
113 activated. <varname>OnBootSec=</varname>
114 defines a timer relative to when the
116 up. <varname>OnStartupSec=</varname>
117 defines a timer relative to when
119 started. <varname>OnUnitActiveSec=</varname>
120 defines a timer relative to when the
121 unit the timer is activating was last
122 activated. <varname>OnUnitInactiveSec=</varname>
123 defines a timer relative to when the
124 unit the timer is activating was last
127 <para>Multiple directives may be
128 combined of the same and of different
129 types. For example, by combining
130 <varname>OnBootSec=</varname> and
131 <varname>OnUnitActiveSec=</varname> it is
132 possible to define a timer that
133 elapses in regular intervals and
134 activates a specific service each
137 <para>The arguments to the directives
138 are time spans configured in
139 seconds. Example: "OnBootSec=50" means
140 50s after boot-up. The argument may
141 also include time units. Example:
142 "OnBootSec=5h 30min" means 5 hours and
143 30 minutes after boot-up. For details
144 about the syntax of time spans see
145 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
147 <para>If a timer configured with
148 <varname>OnBootSec=</varname> or
149 <varname>OnStartupSec=</varname> is
150 already in the past when the timer
151 unit is activated, it will immediately
152 elapse and the configured unit is
153 started. This is not the case for
154 timers defined in the other
157 <para>These are monotonic timers,
158 independent of wall-clock time and timezones. If the
159 computer is temporarily suspended, the
160 monotonic clock stops too.</para>
162 <para>If the empty string is assigned
163 to any of these options, the list of
164 timers is reset, and all prior
165 assignments will have no
166 effect.</para></listitem>
171 <term><varname>OnCalendar=</varname></term>
173 <listitem><para>Defines realtime
174 (i.e. wallclock) timers via calendar
175 event expressions. See
176 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
177 for more information on the syntax of
178 calendar event expressions. Otherwise
179 the semantics are similar to
180 <varname>OnActiveSec=</varname> and
181 related settings.</para></listitem>
185 <term><varname>Unit=</varname></term>
187 <listitem><para>The unit to activate
188 when this timer elapses. The argument is a
189 unit name, whose suffix is not
190 <filename>.timer</filename>. If not
191 specified, this value defaults to a
192 service that has the same name as the
193 timer unit, except for the
194 suffix. (See above.) It is recommended
195 that the unit name that is activated
196 and the unit name of the timer unit
197 are named identically, except for the
198 suffix.</para></listitem>
204 <title>See Also</title>
206 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
207 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
208 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
209 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
210 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
211 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>