]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.unit.xml
man: add a note why %U,%h,%s are mostly useless
[thirdparty/systemd.git] / man / systemd.unit.xml
CommitLineData
d1ab0ca0
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
1a13e31d
ZJS
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
d1ab0ca0
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
d1ab0ca0
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.
d1ab0ca0 22
5430f7f2 23 You should have received a copy of the GNU Lesser General Public License
d1ab0ca0
LP
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25-->
26
27<refentry id="systemd.unit">
28
29 <refentryinfo>
30 <title>systemd.unit</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Lennart</firstname>
37 <surname>Poettering</surname>
38 <email>lennart@poettering.net</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>systemd.unit</refentrytitle>
45 <manvolnum>5</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>systemd.unit</refname>
34511ca7 50 <refpurpose>Unit configuration</refpurpose>
d1ab0ca0
LP
51 </refnamediv>
52
53 <refsynopsisdiv>
13219b7f
ZJS
54 <para><filename><replaceable>service</replaceable>.service</filename>,
55 <filename><replaceable>socket</replaceable>.socket</filename>,
56 <filename><replaceable>device</replaceable>.device</filename>,
57 <filename><replaceable>mount</replaceable>.mount</filename>,
58 <filename><replaceable>automount</replaceable>.automount</filename>,
59 <filename><replaceable>swap</replaceable>.swap</filename>,
60 <filename><replaceable>target</replaceable>.target</filename>,
61 <filename><replaceable>path</replaceable>.path</filename>,
62 <filename><replaceable>timer</replaceable>.timer</filename>,
e73eebfd
LP
63 <filename><replaceable>snapshot</replaceable>.snapshot</filename>,
64 <filename><replaceable>slice</replaceable>.slice</filename>,
65 <filename><replaceable>scope</replaceable>.scope</filename></para>
13219b7f
ZJS
66
67 <para><literallayout><filename>/etc/systemd/system/*</filename>
68<filename>/run/systemd/system/*</filename>
69<filename>/usr/lib/systemd/system/*</filename>
70<filename>...</filename>
71 </literallayout></para>
72
05a2f6fe
TK
73 <para><literallayout><filename>$XDG_CONFIG_HOME/systemd/user/*</filename>
74<filename>$HOME/.config/systemd/user/*</filename>
6f47d17c 75<filename>/etc/systemd/user/*</filename>
aa08982d 76<filename>$XDG_RUNTIME_DIR/systemd/user/*</filename>
13219b7f 77<filename>/run/systemd/user/*</filename>
91acdc17
TK
78<filename>$XDG_DATA_HOME/systemd/user/*</filename>
79<filename>$HOME/.local/share/systemd/user/*</filename>
13219b7f
ZJS
80<filename>/usr/lib/systemd/user/*</filename>
81<filename>...</filename>
82 </literallayout></para>
d1ab0ca0
LP
83 </refsynopsisdiv>
84
85 <refsect1>
86 <title>Description</title>
87
88 <para>A unit configuration file encodes information
771610b0 89 about a service, a socket, a device, a mount point, an
436c44a5 90 automount point, a swap file or partition, a start-up
e73eebfd
LP
91 target, a watched file system path, a timer controlled
92 and supervised by
93 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
94 a temporary system state snapshot, a resource
95 management slice or a group of externally created
96 processes. The syntax is inspired by <ulink
11e29955 97 url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG
e73eebfd
LP
98 Desktop Entry Specification</ulink>
99 <filename>.desktop</filename> files, which are in turn
11e29955
LP
100 inspired by Microsoft Windows
101 <filename>.ini</filename> files.</para>
d1ab0ca0 102
bb31a4ac 103 <para>This man page lists the common configuration
58c16a1a 104 options of all the unit types. These options need to
16dad32e
AE
105 be configured in the [Unit] or [Install]
106 sections of the unit files.</para>
11e29955
LP
107
108 <para>In addition to the generic [Unit] and [Install]
8afbb8e1 109 sections described here, each unit may have a
11e29955
LP
110 type-specific section, e.g. [Service] for a service
111 unit. See the respective man pages for more
13219b7f
ZJS
112 information:
113 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
115 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
116 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
117 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
118 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
119 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
120 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
121 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
122 <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
e73eebfd
LP
123 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
124 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
13219b7f
ZJS
125 </para>
126
6baf995c
ZJS
127 <para>Various settings are allowed to be specified
128 more than once, in which case the interpretation
129 depends on the setting. Often, multiple settings form
130 a list, and setting to an empty value "resets", which
131 means that previous assignments are ignored. When this
132 is allowed, it is mentioned in the description of the
133 setting. Note that using multiple assignments to the
134 same value makes the unit file incompatible with
135 parsers for the XDG <filename>.desktop</filename> file
136 format.</para>
137
13219b7f
ZJS
138 <para>Unit files are loaded from a set of paths
139 determined during compilation, described in the next section.
140 </para>
11e29955
LP
141
142 <para>Unit files may contain additional options on top
143 of those listed here. If systemd encounters an unknown
79640424 144 option, it will write a warning log message but
2bcc2523
MM
145 continue loading the unit. If an option or section name
146 is prefixed with <option>X-</option>, it is ignored
147 completely by systemd. Options within an ignored
148 section do not need the prefix. Applications may use
149 this to include additional information in the unit
150 files.</para>
11e29955
LP
151
152 <para>Boolean arguments used in unit files can be
6cbdbc5f 153 written in various formats. For positive settings the
11e29955
LP
154 strings <option>1</option>, <option>yes</option>,
155 <option>true</option> and <option>on</option> are
79640424 156 equivalent. For negative settings, the strings
11e29955
LP
157 <option>0</option>, <option>no</option>,
158 <option>false</option> and <option>off</option> are
159 equivalent.</para>
160
0d624a78
LP
161 <para>Time span values encoded in unit files can be
162 written in various formats. A stand-alone number
163 specifies a time in seconds. If suffixed with a time
8afbb8e1
LP
164 unit, the unit is honored. A concatenation of multiple
165 values with units is supported, in which case the
166 values are added up. Example: "50" refers to 50
0d624a78
LP
167 seconds; "2min 200ms" refers to 2 minutes plus 200
168 milliseconds, i.e. 120200ms. The following time units
8afbb8e1
LP
169 are understood: s, min, h, d, w, ms, us. For details
170 see
171 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
0d624a78 172
11e29955 173 <para>Empty lines and lines starting with # or ; are
b3eaa628
LP
174 ignored. This may be used for commenting. Lines ending
175 in a backslash are concatenated with the following
176 line while reading and the backslash is replaced by a
177 space character. This may be used to wrap long lines.</para>
11e29955 178
11e29955 179 <para>Along with a unit file
79640424 180 <filename>foo.service</filename>, the directory
11e29955 181 <filename>foo.service.wants/</filename> may exist. All
8afbb8e1
LP
182 unit files symlinked from such a directory are
183 implicitly added as dependencies of type
3e883473 184 <varname>Wants=</varname> to the unit. This is useful
11e29955 185 to hook units into the start-up of other units,
8afbb8e1 186 without having to modify their unit files. For details
3e883473 187 about the semantics of <varname>Wants=</varname>, see
8afbb8e1
LP
188 below. The preferred way to create symlinks in the
189 <filename>.wants/</filename> directory of a unit file
190 is with the <command>enable</command> command of the
ee5762e3 191 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
11e29955 192 tool which reads information from the [Install]
8afbb8e1 193 section of unit files (see below). A similar
0732ec00
LP
194 functionality exists for <varname>Requires=</varname>
195 type dependencies as well, the directory suffix is
196 <filename>.requires/</filename> in this case.</para>
11e29955 197
8afbb8e1 198 <para>Along with a unit file
79640424 199 <filename>foo.service</filename>, a directory
8afbb8e1 200 <filename>foo.service.d/</filename> may exist. All
479fe882 201 files with the suffix <literal>.conf</literal> from
8afbb8e1
LP
202 this directory will be parsed after the file itself is
203 parsed. This is useful to alter or add configuration
204 settings to a unit, without having to modify their
205 unit files. Make sure that the file that is included
206 has the appropriate section headers before any
96ddbf81
LP
207 directive. Note that for instanced units this logic
208 will first look for the instance
209 <literal>.d/</literal> subdirectory and read its
210 <literal>.conf</literal> files, followed by the
211 template <literal>.d/</literal> subdirectory and reads
212 its <literal>.conf</literal> files.</para>
8afbb8e1 213
c073a0c4
LP
214 <!-- Note that we do not document .include here, as we
215 consider it mostly obsolete, and want people to
216 use .d/ drop-ins instead. -->
217
11e29955
LP
218 <para>Note that while systemd offers a flexible
219 dependency system between units it is recommended to
e65c85ab 220 use this functionality only sparingly and instead rely
11e29955 221 on techniques such as bus-based or socket-based
e65c85ab
ZJS
222 activation which make dependencies implicit, resulting
223 in a both simpler and more flexible system.</para>
1f812fea
LP
224
225 <para>Some unit names reflect paths existing in the
12f25b6e 226 file system namespace. Example: a device unit
1f812fea 227 <filename>dev-sda.device</filename> refers to a device
845c5324 228 with the device node <filename noindex='true'>/dev/sda</filename> in
79640424 229 the file system namespace. If this applies, a special
085b94ee 230 way to escape the path name is used, so that the
e9dd9f95 231 result is usable as part of a filename. Basically,
085b94ee
LP
232 given a path, "/" is replaced by "-", and all
233 unprintable characters and the "-" are replaced by
fb7661a6 234 C-style "\x2d" escapes. The root directory "/" is
085b94ee
LP
235 encoded as single dash, while otherwise the initial
236 and ending "/" is removed from all paths during
237 transformation. This escaping is reversible.</para>
1f812fea
LP
238
239 <para>Optionally, units may be instantiated from a
240 template file at runtime. This allows creation of
241 multiple units from a single configuration file. If
79640424 242 systemd looks for a unit configuration file, it will
1f812fea 243 first search for the literal unit name in the
72ebbf34 244 file system. If that yields no success and the unit
05cc7267 245 name contains an <literal>@</literal> character, systemd will look for a
1f812fea 246 unit template that shares the same name but with the
05cc7267 247 instance string (i.e. the part between the <literal>@</literal> character
1f812fea
LP
248 and the suffix) removed. Example: if a service
249 <filename>getty@tty3.service</filename> is requested
250 and no file by that name is found, systemd will look
251 for <filename>getty@.service</filename> and
252 instantiate a service from that configuration file if
0e89268b
MB
253 it is found.</para>
254
255 <para>To refer to the instance string from
1f812fea
LP
256 within the configuration file you may use the special
257 <literal>%i</literal> specifier in many of the
8afbb8e1 258 configuration options. See below for details.</para>
b9aea954 259
6daf4f90 260 <para>If a unit file is empty (i.e. has the file size
79640424 261 0) or is symlinked to <filename>/dev/null</filename>,
6daf4f90
LP
262 its configuration will not be loaded and it appears
263 with a load state of <literal>masked</literal>, and
264 cannot be activated. Use this as an effective way to
265 fully disable a unit, making it impossible to start it
266 even manually.</para>
267
b9aea954
LP
268 <para>The unit file format is covered by the
269 <ulink
270 url="http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface
271 Stability Promise</ulink>.</para>
8afbb8e1 272
d1ab0ca0
LP
273 </refsect1>
274
13219b7f 275 <refsect1>
00d1818b 276 <title>Unit Load Path</title>
13219b7f
ZJS
277
278 <para>Unit files are loaded from a set of paths
279 determined during compilation, described in the two
6f47d17c
LP
280 tables below. Unit files found in directories listed
281 earlier override files with the same name in
282 directories lower in the list.</para>
13219b7f 283
00d1818b 284 <para>When systemd is running in user mode
13219b7f
ZJS
285 (<option>--user</option>) and the variable
286 <varname>$SYSTEMD_UNIT_PATH</varname> is set, this
287 contents of this variable overrides the unit load
cf7d80a5
ZJS
288 path. If <varname>$SYSTEMD_UNIT_PATH</varname> ends
289 with an empty component (<literal>:</literal>), the
290 usual unit load path will be appended to the contents
291 of the variable.</para>
13219b7f
ZJS
292
293 <table>
294 <title>
295 Load path when running in system mode (<option>--system</option>).
296 </title>
297
298 <tgroup cols='2'>
299 <colspec colname='path' />
300 <colspec colname='expl' />
301 <thead>
302 <row>
303 <entry>Path</entry>
304 <entry>Description</entry>
305 </row>
306 </thead>
307 <tbody>
13219b7f
ZJS
308 <row>
309 <entry><filename>/etc/systemd/system</filename></entry>
00d1818b 310 <entry>Local configuration</entry>
13219b7f
ZJS
311 </row>
312 <row>
6f88df57 313 <entry><filename>/run/systemd/system</filename></entry>
6f47d17c 314 <entry>Runtime units</entry>
13219b7f 315 </row>
13219b7f
ZJS
316 <row>
317 <entry><filename>/usr/lib/systemd/system</filename></entry>
6f47d17c 318 <entry>Units of installed packages</entry>
13219b7f
ZJS
319 </row>
320 </tbody>
321 </tgroup>
322 </table>
323
324 <table>
325 <title>
42539b5e 326 Load path when running in user mode (<option>--user</option>).
13219b7f
ZJS
327 </title>
328
329 <tgroup cols='2'>
330 <colspec colname='path' />
331 <colspec colname='expl' />
332 <thead>
333 <row>
334 <entry>Path</entry>
335 <entry>Description</entry>
336 </row>
337 </thead>
338 <tbody>
05a2f6fe
TK
339 <row>
340 <entry><filename>$XDG_CONFIG_HOME/systemd/user</filename></entry>
341 <entry>User configuration (only used when $XDG_CONFIG_HOME is set)</entry>
342 </row>
13219b7f 343 <row>
6f47d17c 344 <entry><filename>$HOME/.config/systemd/user</filename></entry>
05a2f6fe 345 <entry>User configuration (only used when $XDG_CONFIG_HOME is not set)</entry>
13219b7f
ZJS
346 </row>
347 <row>
348 <entry><filename>/etc/systemd/user</filename></entry>
00d1818b 349 <entry>Local configuration</entry>
13219b7f 350 </row>
aa08982d
ZJS
351 <row>
352 <entry><filename>$XDG_RUNTIME_DIR/systemd/user</filename></entry>
353 <entry>Runtime units (only used when $XDG_RUNTIME_DIR is set)</entry>
354 </row>
13219b7f
ZJS
355 <row>
356 <entry><filename>/run/systemd/user</filename></entry>
6f47d17c 357 <entry>Runtime units</entry>
13219b7f 358 </row>
91acdc17
TK
359 <row>
360 <entry><filename>$XDG_DATA_HOME/systemd/user</filename></entry>
361 <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)</entry>
362 </row>
363 <row>
364 <entry><filename>$HOME/.local/share/systemd/user</filename></entry>
365 <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)</entry>
366 </row>
13219b7f
ZJS
367 <row>
368 <entry><filename>/usr/lib/systemd/user</filename></entry>
91acdc17 369 <entry>Units of packages that have been installed system-wide</entry>
13219b7f
ZJS
370 </row>
371 </tbody>
372 </tgroup>
373 </table>
374
13219b7f
ZJS
375 <para>Additional units might be loaded into systemd
376 ("linked") from directories not on the unit load
377 path. See the <command>link</command> command for
6f47d17c
LP
378 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. Also,
379 some units are dynamically created via generators
380 <ulink
381 url="http://www.freedesktop.org/wiki/Software/systemd/Generators/">Generators</ulink>.
13219b7f
ZJS
382 </para>
383 </refsect1>
384
d1ab0ca0 385 <refsect1>
f7be6ffa 386 <title>[Unit] Section Options</title>
d1ab0ca0 387
771610b0
LP
388 <para>Unit file may include a [Unit] section, which
389 carries generic information about the unit that is not
390 dependent on the type of unit:</para>
391
ccc9a4f9 392 <variablelist class='unit-directives'>
11e29955
LP
393
394 <varlistentry>
395 <term><varname>Description=</varname></term>
396 <listitem><para>A free-form string
62adf224
LP
397 describing the unit. This is intended
398 for use in UIs to show descriptive
399 information along with the unit
693093c6
MS
400 name. The description should contain a name
401 that means something to the end user.
402 <literal>Apache2 Web Server</literal> is a good
403 example. Bad examples are
404 <literal>high-performance light-weight HTTP
405 server</literal> (too generic) or
406 <literal>Apache2</literal> (too specific and
407 meaningless for people who do not know
408 Apache).</para></listitem>
11e29955
LP
409 </varlistentry>
410
49dbfa7b
LP
411 <varlistentry>
412 <term><varname>Documentation=</varname></term>
e9dd9f95 413 <listitem><para>A space-separated list
49dbfa7b
LP
414 of URIs referencing documentation for
415 this unit or its
416 configuration. Accepted are only URIs
417 of the types
418 <literal>http://</literal>,
419 <literal>https://</literal>,
420 <literal>file:</literal>,
421 <literal>info:</literal>,
422 <literal>man:</literal>. For more
423 information about the syntax of these
e9dd9f95 424 URIs, see
5aded369 425 <citerefentry project='man-pages'><refentrytitle>uri</refentrytitle><manvolnum>7</manvolnum></citerefentry>. The
f8a2ebbc
LP
426 URIs should be listed in order of
427 relevance, starting with the most
428 relevant. It is a good idea to first
429 reference documentation that explains
430 what the unit's purpose is, followed
431 by how it is configured, followed by
74051b9b 432 any other related documentation. This
b040723e 433 option may be specified more than once,
74051b9b
LP
434 in which case the specified list of
435 URIs is merged. If the empty string is
e9dd9f95 436 assigned to this option, the list is
74051b9b
LP
437 reset and all prior assignments will
438 have no effect.</para></listitem>
49dbfa7b
LP
439 </varlistentry>
440
d1ab0ca0 441 <varlistentry>
9f235308 442 <term><varname>Requires=</varname></term>
771610b0 443
11e29955 444 <listitem><para>Configures requirement
771610b0 445 dependencies on other units. If this
58c16a1a 446 unit gets activated, the units listed
771610b0
LP
447 here will be activated as well. If one
448 of the other units gets deactivated or
449 its activation fails, this unit will
450 be deactivated. This option may be
6a44e50f
ZJS
451 specified more than once or multiple
452 space-separated units may be specified
453 in one option in which case
454 requirement dependencies for all
455 listed names will be created. Note
456 that requirement dependencies do not
11e29955
LP
457 influence the order in which services
458 are started or stopped. This has to be
459 configured independently with the
460 <varname>After=</varname> or
461 <varname>Before=</varname> options. If
462 a unit
463 <filename>foo.service</filename>
464 requires a unit
465 <filename>bar.service</filename> as
466 configured with
467 <varname>Requires=</varname> and no
468 ordering is configured with
469 <varname>After=</varname> or
470 <varname>Before=</varname>, then both
471 units will be started simultaneously
472 and without any delay between them if
473 <filename>foo.service</filename> is
474 activated. Often it is a better choice
475 to use <varname>Wants=</varname>
476 instead of
477 <varname>Requires=</varname> in order
478 to achieve a system that is more
479 robust when dealing with failing
5c315b4f
ZJS
480 services.</para>
481
482 <para>Note that dependencies of this
483 type may also be configured outside of
484 the unit configuration file by
485 adding a symlink to a
486 <filename>.requires/</filename> directory
487 accompanying the unit file. For
488 details see above.</para></listitem>
d1ab0ca0 489 </varlistentry>
11e29955 490
11e29955
LP
491 <varlistentry>
492 <term><varname>RequiresOverridable=</varname></term>
493
494 <listitem><para>Similar to
495 <varname>Requires=</varname>.
496 Dependencies listed in
497 <varname>RequiresOverridable=</varname>
498 which cannot be fulfilled or fail to
58c16a1a 499 start are ignored if the startup was
11e29955
LP
500 explicitly requested by the user. If
501 the start-up was pulled in indirectly
502 by some dependency or automatic
503 start-up of units that is not
79640424 504 requested by the user, this dependency
11e29955
LP
505 must be fulfilled and otherwise the
506 transaction fails. Hence, this option
507 may be used to configure dependencies
4176e530 508 that are normally honored unless the
11e29955
LP
509 user explicitly starts up the unit, in
510 which case whether they failed or not
511 is irrelevant.</para></listitem>
512
513 </varlistentry>
514 <varlistentry>
515 <term><varname>Requisite=</varname></term>
516 <term><varname>RequisiteOverridable=</varname></term>
517
518 <listitem><para>Similar to
6a44e50f
ZJS
519 <varname>Requires=</varname> and
520 <varname>RequiresOverridable=</varname>,
521 respectively. However, if the units
b040723e 522 listed here are not started already,
6a44e50f
ZJS
523 they will not be started and the
524 transaction will fail immediately.
525 </para></listitem>
11e29955
LP
526 </varlistentry>
527
528 <varlistentry>
529 <term><varname>Wants=</varname></term>
530
531 <listitem><para>A weaker version of
6a44e50f 532 <varname>Requires=</varname>. Units
11e29955
LP
533 listed in this option will be started
534 if the configuring unit is. However,
6a44e50f 535 if the listed units fail to start
b040723e 536 or cannot be added to the transaction,
11e29955
LP
537 this has no impact on the validity of
538 the transaction as a whole. This is
539 the recommended way to hook start-up
540 of one unit to the start-up of another
5c315b4f
ZJS
541 unit.</para>
542
543 <para>Note that dependencies of this
11e29955 544 type may also be configured outside of
6a44e50f
ZJS
545 the unit configuration file by adding
546 symlinks to a
11e29955
LP
547 <filename>.wants/</filename> directory
548 accompanying the unit file. For
b040723e 549 details, see above.</para></listitem>
11e29955
LP
550 </varlistentry>
551
b81884e7 552 <varlistentry>
7f2cddae 553 <term><varname>BindsTo=</varname></term>
b81884e7
LP
554
555 <listitem><para>Configures requirement
556 dependencies, very similar in style to
557 <varname>Requires=</varname>, however
b040723e 558 in addition to this behavior, it also
b81884e7
LP
559 declares that this unit is stopped
560 when any of the units listed suddenly
561 disappears. Units can suddenly,
562 unexpectedly disappear if a service
563 terminates on its own choice, a device
564 is unplugged or a mount point
21931dbe 565 unmounted without involvement of
b81884e7
LP
566 systemd.</para></listitem>
567 </varlistentry>
568
85e9a101
MS
569 <varlistentry>
570 <term><varname>PartOf=</varname></term>
571
f3d52e8c
MS
572 <listitem><para>Configures dependencies
573 similar to <varname>Requires=</varname>,
574 but limited to stopping and restarting
575 of units. When systemd stops or restarts
576 the units listed here, the action is
577 propagated to this unit.
e0e009c0 578 Note that this is a one-way dependency —
f3d52e8c
MS
579 changes to this unit do not affect the
580 listed units.
581 </para></listitem>
85e9a101
MS
582 </varlistentry>
583
11e29955
LP
584 <varlistentry>
585 <term><varname>Conflicts=</varname></term>
586
6a44e50f
ZJS
587 <listitem><para>A space-separated list
588 of unit names. Configures negative
11e29955 589 requirement dependencies. If a unit
6a44e50f
ZJS
590 has a <varname>Conflicts=</varname>
591 setting on another unit, starting the
592 former will stop the latter and vice
11e29955
LP
593 versa. Note that this setting is
594 independent of and orthogonal to the
595 <varname>After=</varname> and
596 <varname>Before=</varname> ordering
69dd2852
LP
597 dependencies.</para>
598
599 <para>If a unit A that conflicts with
600 a unit B is scheduled to be started at
601 the same time as B, the transaction
602 will either fail (in case both are
603 required part of the transaction) or
604 be modified to be fixed (in case one
605 or both jobs are not a required part
606 of the transaction). In the latter
b040723e 607 case, the job that is not the required
69dd2852 608 will be removed, or in case both are
b040723e 609 not required, the unit that conflicts
69dd2852
LP
610 will be started and the unit that is
611 conflicted is
612 stopped.</para></listitem>
11e29955
LP
613 </varlistentry>
614
615 <varlistentry>
616 <term><varname>Before=</varname></term>
617 <term><varname>After=</varname></term>
618
6a44e50f
ZJS
619 <listitem><para>A space-separated list
620 of unit names. Configures ordering
11e29955
LP
621 dependencies between units. If a unit
622 <filename>foo.service</filename>
623 contains a setting
624 <option>Before=bar.service</option>
58c16a1a 625 and both units are being started,
11e29955
LP
626 <filename>bar.service</filename>'s
627 start-up is delayed until
628 <filename>foo.service</filename> is
629 started up. Note that this setting is
630 independent of and orthogonal to the
631 requirement dependencies as configured
632 by <varname>Requires=</varname>. It is
633 a common pattern to include a unit
634 name in both the
635 <varname>After=</varname> and
b040723e 636 <varname>Requires=</varname> option, in
11e29955
LP
637 which case the unit listed will be
638 started before the unit that is
639 configured with these options. This
640 option may be specified more than
641 once, in which case ordering
642 dependencies for all listed names are
643 created. <varname>After=</varname> is
644 the inverse of
645 <varname>Before=</varname>, i.e. while
646 <varname>After=</varname> ensures that
647 the configured unit is started after
648 the listed unit finished starting up,
649 <varname>Before=</varname> ensures the
650 opposite, i.e. that the configured
651 unit is fully started up before the
652 listed unit is started. Note that when
653 two units with an ordering dependency
654 between them are shut down, the
58c16a1a 655 inverse of the start-up order is
11e29955
LP
656 applied. i.e. if a unit is configured
657 with <varname>After=</varname> on
658 another unit, the former is stopped
659 before the latter if both are shut
660 down. If one unit with an ordering
661 dependency on another unit is shut
662 down while the latter is started up,
663 the shut down is ordered before the
494a6682 664 start-up regardless of whether the
11e29955
LP
665 ordering dependency is actually of
666 type <varname>After=</varname> or
667 <varname>Before=</varname>. If two
668 units have no ordering dependencies
6a44e50f
ZJS
669 between them, they are shut down or
670 started up simultaneously, and no
671 ordering takes
11e29955
LP
672 place. </para></listitem>
673 </varlistentry>
674
b9975629
LP
675 <varlistentry>
676 <term><varname>OnFailure=</varname></term>
677
6a44e50f
ZJS
678 <listitem><para>A space-separated list
679 of one or more units that are
680 activated when this unit enters the
909f413d 681 <literal>failed</literal>
74ac3cbd 682 state.</para></listitem>
b9975629
LP
683 </varlistentry>
684
4dcc1cb4 685 <varlistentry>
7f2cddae
LP
686 <term><varname>PropagatesReloadTo=</varname></term>
687 <term><varname>ReloadPropagatedFrom=</varname></term>
4dcc1cb4 688
6a44e50f
ZJS
689 <listitem><para>A space-separated list
690 of one or more units where reload
691 requests on this unit will be
692 propagated to, or reload requests on
693 the other unit will be propagated to
694 this unit, respectively. Issuing a
695 reload request on a unit will
696 automatically also enqueue a reload
697 request on all units that the reload
698 request shall be propagated to via
699 these two settings.</para></listitem>
4dcc1cb4
LP
700 </varlistentry>
701
613b411c
LP
702 <varlistentry>
703 <term><varname>JoinsNamespaceOf=</varname></term>
704
705 <listitem><para>For units that start
706 processes (such as service units),
707 lists one or more other units whose
708 network and/or temporary file
709 namespace to join. This only applies
710 to unit types which support the
711 <varname>PrivateNetwork=</varname> and
712 <varname>PrivateTmp=</varname>
713 directives (see
714 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
715 for details). If a unit that has this
b040723e 716 setting set is started, its processes
613b411c
LP
717 will see the same
718 <filename>/tmp</filename>,
719 <filename>/tmp/var</filename> and
720 network namespace as one listed unit
721 that is started. If multiple listed
b040723e 722 units are already started, it is not
613b411c
LP
723 defined which namespace is
724 joined. Note that this setting only
725 has an effect if
726 <varname>PrivateNetwork=</varname>
727 and/or <varname>PrivateTmp=</varname>
728 is enabled for both the unit that
729 joins the namespace and the unit whose
730 namespace is joined.</para></listitem>
731 </varlistentry>
732
7c8fa05c
LP
733 <varlistentry>
734 <term><varname>RequiresMountsFor=</varname></term>
735
5d2abc04
ZJS
736 <listitem><para>Takes a
737 space-separated list of absolute
738 paths. Automatically adds dependencies
739 of type <varname>Requires=</varname>
740 and <varname>After=</varname> for all
7c8fa05c 741 mount units required to access the
5d2abc04
ZJS
742 specified path.</para>
743
744 <para>Mount points marked with
745 <option>noauto</option> are not
746 mounted automatically and will be
747 ignored for the purposes of this
748 option. If such a mount should be a
749 requirement for this unit,
750 direct dependencies on the mount
751 units may be added
752 (<varname>Requires=</varname> and
753 <varname>After=</varname> or
754 some other combination).
755 </para></listitem>
7c8fa05c
LP
756 </varlistentry>
757
222ae6a8 758 <varlistentry>
d420282b
LP
759 <term><varname>OnFailureJobMode=</varname></term>
760
761 <listitem><para>Takes a value of
762 <literal>fail</literal>,
763 <literal>replace</literal>,
4dc5b821
LP
764 <literal>replace-irreversibly</literal>,
765 <literal>isolate</literal>,
766 <literal>flush</literal>,
767 <literal>ignore-dependencies</literal>
d420282b 768 or
4dc5b821 769 <literal>ignore-requirements</literal>. Defaults
d420282b
LP
770 to
771 <literal>replace</literal>. Specifies
772 how the units listed in
222ae6a8 773 <varname>OnFailure=</varname> will be
4dc5b821
LP
774 enqueued. See
775 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
776 <option>--job-mode=</option> option
777 for details on the possible values. If
d420282b
LP
778 this is set to
779 <literal>isolate</literal>, only a
222ae6a8 780 single unit may be listed in
d420282b 781 <varname>OnFailure=</varname>..</para></listitem>
222ae6a8
LP
782 </varlistentry>
783
c8f4d764
LP
784 <varlistentry>
785 <term><varname>IgnoreOnIsolate=</varname></term>
786
787 <listitem><para>Takes a boolean
79640424 788 argument. If <option>true</option>,
c8f4d764
LP
789 this unit will not be stopped when
790 isolating another unit. Defaults to
791 <option>false</option>.</para></listitem>
792 </varlistentry>
793
7a6000a6
LP
794 <varlistentry>
795 <term><varname>IgnoreOnSnapshot=</varname></term>
796
797 <listitem><para>Takes a boolean
79640424 798 argument. If <option>true</option>,
7a6000a6
LP
799 this unit will not be included in
800 snapshots. Defaults to
4e7f8bc8
ZJS
801 <option>true</option> for device and
802 snapshot units, <option>false</option>
7a6000a6
LP
803 for the others.</para></listitem>
804 </varlistentry>
805
11e29955
LP
806 <varlistentry>
807 <term><varname>StopWhenUnneeded=</varname></term>
808
809 <listitem><para>Takes a boolean
79640424 810 argument. If <option>true</option>,
11e29955
LP
811 this unit will be stopped when it is
812 no longer used. Note that in order to
58c16a1a
813 minimize the work to be executed,
814 systemd will not stop units by default
11e29955
LP
815 unless they are conflicting with other
816 units, or the user explicitly
817 requested their shut down. If this
58c16a1a 818 option is set, a unit will be
11e29955
LP
819 automatically cleaned up if no other
820 active unit requires it. Defaults to
821 <option>false</option>.</para></listitem>
822 </varlistentry>
823
824 <varlistentry>
b5e9dba8
LP
825 <term><varname>RefuseManualStart=</varname></term>
826 <term><varname>RefuseManualStop=</varname></term>
11e29955
LP
827
828 <listitem><para>Takes a boolean
79640424 829 argument. If <option>true</option>,
58c16a1a 830 this unit can only be activated
16dad32e 831 or deactivated indirectly. In
79640424 832 this case, explicit start-up
16dad32e 833 or termination requested by the
b5e9dba8 834 user is denied, however if it is
16dad32e 835 started or stopped as a
58c16a1a 836 dependency of another unit, start-up
16dad32e 837 or termination will succeed. This
b5e9dba8
LP
838 is mostly a safety feature to ensure
839 that the user does not accidentally
840 activate units that are not intended
841 to be activated explicitly, and not
842 accidentally deactivate units that are
843 not intended to be deactivated.
844 These options default to
11e29955
LP
845 <option>false</option>.</para></listitem>
846 </varlistentry>
847
2528a7a6
LP
848 <varlistentry>
849 <term><varname>AllowIsolate=</varname></term>
850
851 <listitem><para>Takes a boolean
79640424 852 argument. If <option>true</option>,
2528a7a6
LP
853 this unit may be used with the
854 <command>systemctl isolate</command>
79640424 855 command. Otherwise, this will be
2528a7a6
LP
856 refused. It probably is a good idea to
857 leave this disabled except for target
858 units that shall be used similar to
859 runlevels in SysV init systems, just
860 as a precaution to avoid unusable
861 system states. This option defaults to
862 <option>false</option>.</para></listitem>
863 </varlistentry>
864
62adf224
LP
865 <varlistentry>
866 <term><varname>DefaultDependencies=</varname></term>
867
868 <listitem><para>Takes a boolean
79640424 869 argument. If <option>true</option>,
62adf224
LP
870 (the default), a few default
871 dependencies will implicitly be
872 created for the unit. The actual
873 dependencies created depend on the
874 unit type. For example, for service
875 units, these dependencies ensure that
876 the service is started only after
877 basic system initialization is
58c16a1a 878 completed and is properly terminated on
62adf224
LP
879 system shutdown. See the respective
880 man pages for details. Generally, only
881 services involved with early boot or
882 late shutdown should set this option
883 to <option>false</option>. It is
884 highly recommended to leave this
885 option enabled for the majority of
886 common units. If set to
409dee2e 887 <option>false</option>, this option
62adf224
LP
888 does not disable all implicit
889 dependencies, just non-essential
890 ones.</para></listitem>
891 </varlistentry>
892
b9975629
LP
893 <varlistentry>
894 <term><varname>JobTimeoutSec=</varname></term>
f189ab18
LP
895 <term><varname>JobTimeoutAction=</varname></term>
896 <term><varname>JobTimeoutRebootArgument=</varname></term>
897
898 <listitem><para>When a job for this
899 unit is queued a time-out may be
900 configured. If this time limit is
901 reached, the job will be cancelled,
902 the unit however will not change state
903 or even enter the
904 <literal>failed</literal> mode. This
905 value defaults to 0 (job timeouts
906 disabled), except for device
74ac3cbd
MM
907 units. NB: this timeout is independent
908 from any unit-specific timeout (for
909 example, the timeout set with
f189ab18 910 <varname>StartTimeoutSec=</varname> in service
74ac3cbd
MM
911 units) as the job timeout has no
912 effect on the unit itself, only on the
913 job that might be pending for it. Or
914 in other words: unit-specific timeouts
b9975629
LP
915 are useful to abort unit state
916 changes, and revert them. The job
917 timeout set with this option however
74ac3cbd
MM
918 is useful to abort only the job
919 waiting for the unit state to
f189ab18
LP
920 change.</para>
921
922 <para><varname>JobTimeoutAction=</varname>
923 optionally configures an additional
924 action to take when the time-out is
925 hit. It takes the same values as the
926 per-service
927 <varname>StartLimitAction=</varname>
928 setting, see
929 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
930 for details. Defaults to
931 <option>none</option>. <varname>JobTimeoutRebootArgument=</varname>
932 configures an optional reboot string
933 to pass to the
934 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
935 system call.</para></listitem>
b9975629
LP
936 </varlistentry>
937
52661efd 938 <varlistentry>
099524d7
LP
939 <term><varname>ConditionArchitecture=</varname></term>
940 <term><varname>ConditionVirtualization=</varname></term>
941 <term><varname>ConditionHost=</varname></term>
942 <term><varname>ConditionKernelCommandLine=</varname></term>
943 <term><varname>ConditionSecurity=</varname></term>
944 <term><varname>ConditionCapability=</varname></term>
945 <term><varname>ConditionACPower=</varname></term>
cdf0c7ab 946 <term><varname>ConditionNeedsUpdate=</varname></term>
e2680723 947 <term><varname>ConditionFirstBoot=</varname></term>
52661efd 948 <term><varname>ConditionPathExists=</varname></term>
8092a428 949 <term><varname>ConditionPathExistsGlob=</varname></term>
c61e77d3 950 <term><varname>ConditionPathIsDirectory=</varname></term>
0d60602c 951 <term><varname>ConditionPathIsSymbolicLink=</varname></term>
ab7f148f 952 <term><varname>ConditionPathIsMountPoint=</varname></term>
d0516109 953 <term><varname>ConditionPathIsReadWrite=</varname></term>
36af55d9 954 <term><varname>ConditionDirectoryNotEmpty=</varname></term>
742a862b 955 <term><varname>ConditionFileNotEmpty=</varname></term>
82e487c5 956 <term><varname>ConditionFileIsExecutable=</varname></term>
90a2ec10
LP
957
958 <!-- We don't document ConditionNull=
959 here as it is not particularly
960 useful and probably just
961 confusing. -->
52661efd
LP
962
963 <listitem><para>Before starting a unit
964 verify that the specified condition is
79640424 965 true. If it is not true, the starting
c0d6e764
LP
966 of the unit will be skipped, however
967 all ordering dependencies of it are
968 still respected. A failing condition
969 will not result in the unit being
970 moved into a failure state. The
971 condition is checked at the time the
972 queued start job is to be
973 executed.</para>
974
099524d7
LP
975 <para><varname>ConditionArchitecture=</varname>
976 may be used to check whether the
977 system is running on a specific
978 architecture. Takes one of
979 <varname>x86</varname>,
980 <varname>x86-64</varname>,
981 <varname>ppc</varname>,
f1e4d93f 982 <varname>ppc-le</varname>,
099524d7 983 <varname>ppc64</varname>,
f1e4d93f 984 <varname>ppc64-le</varname>,
099524d7
LP
985 <varname>ia64</varname>,
986 <varname>parisc</varname>,
987 <varname>parisc64</varname>,
988 <varname>s390</varname>,
989 <varname>s390x</varname>,
990 <varname>sparc</varname>,
991 <varname>sparc64</varname>,
992 <varname>mips</varname>,
f1e4d93f 993 <varname>mips-le</varname>,
099524d7 994 <varname>mips64</varname>,
f1e4d93f 995 <varname>mips64-le</varname>,
099524d7
LP
996 <varname>alpha</varname>,
997 <varname>arm</varname>,
998 <varname>arm-be</varname>,
999 <varname>arm64</varname>,
1000 <varname>arm64-be</varname>,
1001 <varname>sh</varname>,
1002 <varname>sh64</varname>,
f1e4d93f
LP
1003 <varname>m86k</varname>,
1004 <varname>tilegx</varname>,
1005 <varname>cris</varname> to test
099524d7
LP
1006 against a specific architecture. The
1007 architecture is determined from the
1008 information returned by
1009 <citerefentry><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1010 and is thus subject to
1011 <citerefentry><refentrytitle>personality</refentrytitle><manvolnum>2</manvolnum></citerefentry>. Note
1012 that a <varname>Personality=</varname>
1013 setting in the same unit file has no
1014 effect on this condition. A special
1015 architecture name
1016 <varname>native</varname> is mapped to
1017 the architecture the system manager
1018 itself is compiled for. The test may
1019 be negated by prepending an
1020 exclamation mark.</para>
c0d6e764
LP
1021
1022 <para><varname>ConditionVirtualization=</varname>
039655a4
LP
1023 may be used to check whether the
1024 system is executed in a virtualized
1025 environment and optionally test
1026 whether it is a specific
1027 implementation. Takes either boolean
267632f0 1028 value to check if being executed in
8095200d
LP
1029 any virtualized environment, or one of
1030 <varname>vm</varname> and
62590f23 1031 <varname>container</varname> to test
c0d6e764 1032 against a generic type of
62590f23 1033 virtualization solution, or one of
039655a4
LP
1034 <varname>qemu</varname>,
1035 <varname>kvm</varname>,
f41925b4 1036 <varname>zvm</varname>,
039655a4
LP
1037 <varname>vmware</varname>,
1038 <varname>microsoft</varname>,
1039 <varname>oracle</varname>,
1040 <varname>xen</varname>,
8095200d 1041 <varname>bochs</varname>,
7080ea16 1042 <varname>uml</varname>,
65bc2c21
LP
1043 <varname>openvz</varname>,
1044 <varname>lxc</varname>,
7d39db92 1045 <varname>lxc-libvirt</varname>,
e737ef15
LP
1046 <varname>systemd-nspawn</varname>,
1047 <varname>docker</varname> to test
1048 against a specific implementation. See
1049 <citerefentry><refentrytitle>systemd-detect-virt</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1050 for a full list of known
1051 virtualization technologies and their
1052 identifiers. If multiple
1053 virtualization technologies are
1054 nested, only the innermost is
1055 considered. The test may be negated by
1056 prepending an exclamation mark.</para>
c0d6e764 1057
099524d7
LP
1058 <para><varname>ConditionHost=</varname>
1059 may be used to match against the
1060 hostname or machine ID of the
1061 host. This either takes a hostname
1062 string (optionally with shell style
1063 globs) which is tested against the
1064 locally set hostname as returned by
1065 <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
1066 or a machine ID formatted as string
1067 (see
1068 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
1069 The test may be negated by prepending
1070 an exclamation mark.</para>
1071
1072 <para><varname>ConditionKernelCommandLine=</varname>
1073 may be used to check whether a
1074 specific kernel command line option is
1075 set (or if prefixed with the
1076 exclamation mark unset). The argument
1077 must either be a single word, or an
1078 assignment (i.e. two words, separated
1079 <literal>=</literal>). In the former
1080 case the kernel command line is
1081 searched for the word appearing as is,
1082 or as left hand side of an
b8bde116 1083 assignment. In the latter case, the
099524d7
LP
1084 exact assignment is looked for with
1085 right and left hand side
1086 matching.</para>
1087
c0d6e764 1088 <para><varname>ConditionSecurity=</varname>
8092a428
LP
1089 may be used to check whether the given
1090 security module is enabled on the
cfb1f5df
LP
1091 system. Currently the recognized
1092 values values are
1093 <varname>selinux</varname>,
9d995d54 1094 <varname>apparmor</varname>,
cfb1f5df
LP
1095 <varname>ima</varname>,
1096 <varname>smack</varname> and
1097 <varname>audit</varname>. The test may
1098 be negated by prepending an
1099 exclamation mark.</para>
c0d6e764
LP
1100
1101 <para><varname>ConditionCapability=</varname>
62590f23
LP
1102 may be used to check whether the given
1103 capability exists in the capability
1104 bounding set of the service manager
1105 (i.e. this does not check whether
1106 capability is actually available in
1107 the permitted or effective sets, see
5aded369 1108 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
62590f23
LP
1109 for details). Pass a capability name
1110 such as <literal>CAP_MKNOD</literal>,
1111 possibly prefixed with an exclamation
c0d6e764
LP
1112 mark to negate the check.</para>
1113
240dbaa4 1114 <para><varname>ConditionACPower=</varname>
e711d102
TA
1115 may be used to check whether the
1116 system has AC power, or is exclusively
240dbaa4
LP
1117 battery powered at the time of
1118 activation of the unit. This takes a
1119 boolean argument. If set to
79640424 1120 <varname>true</varname>, the condition
240dbaa4
LP
1121 will hold only if at least one AC
1122 connector of the system is connected
1123 to a power source, or if no AC
1124 connectors are known. Conversely, if
79640424 1125 set to <varname>false</varname>, the
240dbaa4
LP
1126 condition will hold only if there is
1127 at least one AC connector known and
1128 all AC connectors are disconnected
1129 from a power source.</para>
1130
cdf0c7ab
LP
1131 <para><varname>ConditionNeedsUpdate=</varname>
1132 takes one of <filename>/var</filename>
1133 or <filename>/etc</filename> as
1134 argument, possibly prefixed with a
1135 <literal>!</literal> (for inverting
1136 the condition). This condition may be
1137 used to conditionalize units on
1138 whether the specified directory
1139 requires an update because
1140 <filename>/usr</filename>'s
1141 modification time is newer than the
1142 stamp file
1143 <filename>.updated</filename> in the
1144 specified directory. This is useful to
1145 implement offline updates of the
1146 vendor operating system resources in
1147 <filename>/usr</filename> that require
1148 updating of <filename>/etc</filename>
1149 or <filename>/var</filename> on the
1150 next following boot. Units making use
1151 of this condition should order
1152 themselves before
1153 <citerefentry><refentrytitle>systemd-update-done.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1154 to make sure they run before the stamp
1155 files's modification time gets reset
1156 indicating a completed update.</para>
1157
e2680723
LP
1158 <para><varname>ConditionFirstBoot=</varname>
1159 takes a boolean argument. This
1160 condition may be used to
1161 conditionalize units on whether the
1162 system is booting up with an
1163 unpopulated <filename>/etc</filename>
1164 directory. This may be used to
1165 populate <filename>/etc</filename> on
1166 the first boot after factory reset, or
1167 when a new system instances boots up
1168 for the first time.</para>
1169
099524d7
LP
1170 <para>With
1171 <varname>ConditionPathExists=</varname>
1172 a file existence condition is
1173 checked before a unit is started. If
1174 the specified absolute path name does
1175 not exist, the condition will
1176 fail. If the absolute path name passed
1177 to
1178 <varname>ConditionPathExists=</varname>
1179 is prefixed with an exclamation mark
1180 (<literal>!</literal>), the test is negated, and the unit
1181 is only started if the path does not
1182 exist.</para>
1183
1184 <para><varname>ConditionPathExistsGlob=</varname>
1185 is similar to
1186 <varname>ConditionPathExists=</varname>,
1187 but checks for the existence of at
1188 least one file or directory matching
1189 the specified globbing pattern.</para>
1190
1191 <para><varname>ConditionPathIsDirectory=</varname>
1192 is similar to
1193 <varname>ConditionPathExists=</varname>
1194 but verifies whether a certain path
1195 exists and is a
1196 directory.</para>
1197
1198 <para><varname>ConditionPathIsSymbolicLink=</varname>
1199 is similar to
1200 <varname>ConditionPathExists=</varname>
1201 but verifies whether a certain path
1202 exists and is a symbolic
1203 link.</para>
1204
1205 <para><varname>ConditionPathIsMountPoint=</varname>
1206 is similar to
1207 <varname>ConditionPathExists=</varname>
1208 but verifies whether a certain path
1209 exists and is a mount
1210 point.</para>
1211
1212 <para><varname>ConditionPathIsReadWrite=</varname>
1213 is similar to
1214 <varname>ConditionPathExists=</varname>
1215 but verifies whether the underlying
1216 file system is readable and writable
1217 (i.e. not mounted
1218 read-only).</para>
1219
1220 <para><varname>ConditionDirectoryNotEmpty=</varname>
1221 is similar to
1222 <varname>ConditionPathExists=</varname>
1223 but verifies whether a certain path
1224 exists and is a non-empty
1225 directory.</para>
1226
1227 <para><varname>ConditionFileNotEmpty=</varname>
1228 is similar to
1229 <varname>ConditionPathExists=</varname>
1230 but verifies whether a certain path
1231 exists and refers to a regular file
1232 with a non-zero size.</para>
1233
1234 <para><varname>ConditionFileIsExecutable=</varname>
1235 is similar to
1236 <varname>ConditionPathExists=</varname>
1237 but verifies whether a certain path
1238 exists, is a regular file and marked
1239 executable.</para>
1240
c0d6e764 1241 <para>If multiple conditions are
79640424 1242 specified, the unit will be executed if
267632f0
LP
1243 all of them apply (i.e. a logical AND
1244 is applied). Condition checks can be
1245 prefixed with a pipe symbol (|) in
1246 which case a condition becomes a
1247 triggering condition. If at least one
1248 triggering condition is defined for a
79640424 1249 unit, then the unit will be executed if
267632f0
LP
1250 at least one of the triggering
1251 conditions apply and all of the
1252 non-triggering conditions. If you
1253 prefix an argument with the pipe
79640424 1254 symbol and an exclamation mark, the
267632f0 1255 pipe symbol must be passed first, the
0d60602c
MS
1256 exclamation second. Except for
1257 <varname>ConditionPathIsSymbolicLink=</varname>,
74051b9b
LP
1258 all path checks follow symlinks. If
1259 any of these options is assigned the
79640424 1260 empty string, the list of conditions is
74051b9b
LP
1261 reset completely, all previous
1262 condition settings (of any kind) will
1263 have no effect.</para></listitem>
52661efd 1264 </varlistentry>
e2130f18 1265
59fccdc5
LP
1266 <varlistentry>
1267 <term><varname>AssertArchitecture=</varname></term>
1268 <term><varname>AssertVirtualization=</varname></term>
1269 <term><varname>AssertHost=</varname></term>
1270 <term><varname>AssertKernelCommandLine=</varname></term>
1271 <term><varname>AssertSecurity=</varname></term>
1272 <term><varname>AssertCapability=</varname></term>
1273 <term><varname>AssertACPower=</varname></term>
1274 <term><varname>AssertNeedsUpdate=</varname></term>
1275 <term><varname>AssertFirstBoot=</varname></term>
1276 <term><varname>AssertPathExists=</varname></term>
1277 <term><varname>AssertPathExistsGlob=</varname></term>
1278 <term><varname>AssertPathIsDirectory=</varname></term>
1279 <term><varname>AssertPathIsSymbolicLink=</varname></term>
1280 <term><varname>AssertPathIsMountPoint=</varname></term>
1281 <term><varname>AssertPathIsReadWrite=</varname></term>
1282 <term><varname>AssertDirectoryNotEmpty=</varname></term>
1283 <term><varname>AssertFileNotEmpty=</varname></term>
1284 <term><varname>AssertFileIsExecutable=</varname></term>
59fccdc5
LP
1285
1286 <listitem><para>Similar to the
1287 <varname>ConditionArchitecture=</varname>,
1288 <varname>ConditionVirtualization=</varname>,
1289 ... condition settings described above
1290 these settings add assertion checks to
1291 the start-up of the unit. However,
1292 unlike the conditions settings any
1293 assertion setting that is not met
1294 results in failure of the start
1295 job it was triggered by.</para></listitem>
1296 </varlistentry>
1297
1b64d026
LP
1298 <varlistentry>
1299 <term><varname>SourcePath=</varname></term>
1300 <listitem><para>A path to a
1301 configuration file this unit has been
1302 generated from. This is primarily
1303 useful for implementation of generator
1304 tools that convert configuration from
1305 an external configuration file format
0a498f16 1306 into native unit files. This
1b64d026
LP
1307 functionality should not be used in
1308 normal units.</para></listitem>
1309 </varlistentry>
d1ab0ca0 1310 </variablelist>
771610b0 1311
f7be6ffa
LP
1312 </refsect1>
1313
1314 <refsect1>
1315 <title>[Install] Section Options</title>
1316
2915a7bd
LP
1317 <para>Unit file may include an
1318 <literal>[Install]</literal> section, which carries
1319 installation information for the unit. This section is
1320 not interpreted by
771610b0
LP
1321 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1322 during runtime. It is used exclusively by the
ee5762e3
LP
1323 <command>enable</command> and
1324 <command>disable</command> commands of the
1325 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
11e29955 1326 tool during installation of a unit:</para>
771610b0 1327
ccc9a4f9 1328 <variablelist class='unit-directives'>
771610b0
LP
1329 <varlistentry>
1330 <term><varname>Alias=</varname></term>
1331
2915a7bd 1332 <listitem><para>A space-separated list
6a44e50f
ZJS
1333 of additional names this unit shall be
1334 installed under. The names listed here
1335 must have the same suffix (i.e. type)
1336 as the unit file name. This option may
1337 be specified more than once, in which
1338 case all listed names are used. At
1339 installation time, <command>systemctl
1340 enable</command> will create symlinks
1341 from these names to the unit
1342 filename.</para></listitem>
11e29955
LP
1343 </varlistentry>
1344
1345 <varlistentry>
1346 <term><varname>WantedBy=</varname></term>
78d54bd4 1347 <term><varname>RequiredBy=</varname></term>
11e29955 1348
6a44e50f
ZJS
1349 <listitem><para>This option may be
1350 used more than once, or a
1351 space-separated list of unit names may
1352 be given. A symbolic link is created
1353 in the <filename>.wants/</filename> or
1354 <filename>.requires/</filename>
1355 directory of each of the listed units
1356 when this unit is installed by
1357 <command>systemctl enable</command>.
1358 This has the effect that a dependency
1359 of type <varname>Wants=</varname> or
3eb13957
ZJS
1360 <varname>Requires=</varname> is added
1361 from the listed unit to the current
1362 unit. The primary result is that the
1363 current unit will be started when the
1364 listed unit is started. See the
1365 description of
1366 <varname>Wants=</varname> and
1367 <varname>Requires=</varname> in the
1368 [Unit] section for details.</para>
1369
1370 <para><command>WantedBy=foo.service</command>
11e29955
LP
1371 in a service
1372 <filename>bar.service</filename> is
1373 mostly equivalent to
1374 <command>Alias=foo.service.wants/bar.service</command>
3eb13957
ZJS
1375 in the same file. In case of template
1376 units, <command>systemctl enable</command>
1377 must be called with an instance name, and
1378 this instance will be added to the
1379 <filename>.wants/</filename> or
1380 <filename>.requires/</filename> list
1381 of the listed unit.
1382 E.g. <command>WantedBy=getty.target</command>
1383 in a service
1384 <filename>getty@.service</filename>
1385 will result in <command>systemctl
1386 enable getty@tty2.service</command>
1387 creating a
1388 <filename>getty.target.wants/getty@tty2.service</filename>
1389 link to <filename>getty@.service</filename>.
1390 </para></listitem>
11e29955
LP
1391 </varlistentry>
1392
1393 <varlistentry>
1394 <term><varname>Also=</varname></term>
1395
1396 <listitem><para>Additional units to
a7be37a5
LP
1397 install/deinstall when this unit is
1398 installed/deinstalled. If the user
1399 requests installation/deinstallation
1400 of a unit with this option configured,
ee5762e3 1401 <command>systemctl enable</command>
a7be37a5
LP
1402 and <command>systemctl
1403 disable</command> will automatically
1404 install/uninstall units listed in this option as
6a44e50f
ZJS
1405 well.</para>
1406
1407 <para>This option may be used more
1408 than once, or a space-separated list
1409 of unit names may be
1410 given.</para></listitem>
771610b0 1411 </varlistentry>
d54c4993
LP
1412
1413 <varlistentry>
1414 <term><varname>DefaultInstance=</varname></term>
1415
8d0e0ddd 1416 <listitem><para>In template unit files,
d54c4993
LP
1417 this specifies for which instance the
1418 unit shall be enabled if the template
1419 is enabled without any explicitly set
1420 instance. This option has no effect in
1421 non-template unit files. The specified
1422 string must be usable as instance
1423 identifier.</para></listitem>
1424 </varlistentry>
771610b0
LP
1425 </variablelist>
1426
7584d236 1427 <para>The following specifiers are interpreted in the
6aaa8c2f 1428 Install section: %n, %N, %p, %i, %U, %u, %m, %H, %b, %v.
7584d236
ZJS
1429 For their meaning see the next section.
1430 </para>
d1ab0ca0
LP
1431 </refsect1>
1432
8afbb8e1
LP
1433 <refsect1>
1434 <title>Specifiers</title>
1435
1436 <para>Many settings resolve specifiers which may be
1437 used to write generic unit files referring to runtime
1438 or unit parameters that are replaced when the unit
1439 files are loaded. The following specifiers are
1440 understood:</para>
1441
1442 <table>
1443 <title>Specifiers available in unit files</title>
1444 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
1445 <colspec colname="spec" />
1446 <colspec colname="mean" />
1447 <colspec colname="detail" />
1448 <thead>
1449 <row>
1450 <entry>Specifier</entry>
1451 <entry>Meaning</entry>
1452 <entry>Details</entry>
1453 </row>
1454 </thead>
1455 <tbody>
1456 <row>
1457 <entry><literal>%n</literal></entry>
1458 <entry>Full unit name</entry>
1459 <entry></entry>
1460 </row>
1461 <row>
1462 <entry><literal>%N</literal></entry>
1463 <entry>Unescaped full unit name</entry>
2cfbd749 1464 <entry>Same as <literal>%n</literal>, but with escaping undone</entry>
8afbb8e1
LP
1465 </row>
1466 <row>
1467 <entry><literal>%p</literal></entry>
1468 <entry>Prefix name</entry>
b040723e 1469 <entry>For instantiated units, this refers to the string before the <literal>@</literal> character of the unit name. For non-instantiated units, this refers to the name of the unit with the type suffix removed.</entry>
8afbb8e1
LP
1470 </row>
1471 <row>
1472 <entry><literal>%P</literal></entry>
1473 <entry>Unescaped prefix name</entry>
2cfbd749 1474 <entry>Same as <literal>%p</literal>, but with escaping undone</entry>
8afbb8e1
LP
1475 </row>
1476 <row>
1477 <entry><literal>%i</literal></entry>
1478 <entry>Instance name</entry>
2cfbd749 1479 <entry>For instantiated units: this is the string between the <literal>@</literal> character and the suffix of the unit name.</entry>
8afbb8e1
LP
1480 </row>
1481 <row>
1482 <entry><literal>%I</literal></entry>
1483 <entry>Unescaped instance name</entry>
2cfbd749 1484 <entry>Same as <literal>%i</literal>, but with escaping undone</entry>
8afbb8e1
LP
1485 </row>
1486 <row>
1487 <entry><literal>%f</literal></entry>
e9dd9f95 1488 <entry>Unescaped filename</entry>
2cfbd749 1489 <entry>This is either the unescaped instance name (if applicable) with <filename>/</filename> prepended (if applicable), or the prefix name prepended with <filename>/</filename>.</entry>
8afbb8e1
LP
1490 </row>
1491 <row>
1492 <entry><literal>%c</literal></entry>
1493 <entry>Control group path of the unit</entry>
2cfbd749 1494 <entry>This path does not include the <filename>/sys/fs/cgroup/systemd/</filename> prefix.</entry>
8afbb8e1
LP
1495 </row>
1496 <row>
1497 <entry><literal>%r</literal></entry>
2cfbd749
LP
1498 <entry>Control group path of the slice the unit is placed in</entry>
1499 <entry>This usually maps to the parent cgroup path of <literal>%c</literal>.</entry>
8afbb8e1
LP
1500 </row>
1501 <row>
1502 <entry><literal>%R</literal></entry>
15f2a3a9 1503 <entry>Root control group path below which slices and units are placed</entry>
2cfbd749 1504 <entry>For system instances, this resolves to <filename>/</filename>, except in containers, where this maps to the container's root control group path.</entry>
8afbb8e1
LP
1505 </row>
1506 <row>
1507 <entry><literal>%t</literal></entry>
2cfbd749
LP
1508 <entry>Runtime directory</entry>
1509 <entry>This is either <filename>/run</filename> (for the system manager) or the path <literal>$XDG_RUNTIME_DIR</literal> resolves to (for user managers).</entry>
8afbb8e1
LP
1510 </row>
1511 <row>
1512 <entry><literal>%u</literal></entry>
1513 <entry>User name</entry>
1514 <entry>This is the name of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
1515 </row>
1516 <row>
1517 <entry><literal>%U</literal></entry>
1518 <entry>User UID</entry>
2cfbd749 1519 <entry>This is the numeric UID of the configured user of the unit, or (if none is set) the user running the systemd user instance. Note that this specifier is not available for units run by the systemd system instance (as opposed to those run by a systemd user instance), unless the user has been configured as a numeric UID in the first place or the configured user is the root user.</entry>
8afbb8e1
LP
1520 </row>
1521 <row>
1522 <entry><literal>%h</literal></entry>
1523 <entry>User home directory</entry>
b040723e 1524 <entry>This is the home directory of the configured user of the unit, or (if none is set) the user running the systemd user instance. Similar to <literal>%U</literal>, this specifier is not available for units run by the systemd system instance, unless the configured user is the root user.</entry>
8afbb8e1
LP
1525 </row>
1526 <row>
1527 <entry><literal>%s</literal></entry>
1528 <entry>User shell</entry>
b040723e 1529 <entry>This is the shell of the configured user of the unit, or (if none is set) the user running the systemd user instance. Similar to <literal>%U</literal>, this specifier is not available for units run by the systemd system instance, unless the configured user is the root user.</entry>
8afbb8e1
LP
1530 </row>
1531 <row>
1532 <entry><literal>%m</literal></entry>
1533 <entry>Machine ID</entry>
1534 <entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
1535 </row>
1536 <row>
1537 <entry><literal>%b</literal></entry>
1538 <entry>Boot ID</entry>
1539 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
1540 </row>
1541 <row>
1542 <entry><literal>%H</literal></entry>
1543 <entry>Host name</entry>
2cfbd749 1544 <entry>The hostname of the running system at the point in time the unit configuation is loaded.</entry>
8afbb8e1 1545 </row>
6aaa8c2f
ZJS
1546 <row>
1547 <entry><literal>%v</literal></entry>
1548 <entry>Kernel release</entry>
2cfbd749 1549 <entry>Identical to <command>uname -r</command> output</entry>
6aaa8c2f 1550 </row>
599391d8
ZJS
1551 <row>
1552 <entry><literal>%%</literal></entry>
2cfbd749
LP
1553 <entry>Single percent sign</entry>
1554 <entry>Use <literal>%%</literal> in place of <literal>%</literal> to specify a single percent sign.</entry>
599391d8 1555 </row>
8afbb8e1
LP
1556 </tbody>
1557 </tgroup>
1558 </table>
b7a4d8de
ZJS
1559
1560 <para>Please note that specifiers
1561 <literal>%U</literal>, <literal>%h</literal>,
1562 <literal>%s</literal> are mostly useless when systemd
1563 is running in system mode. PID 1 cannot query the
1564 user account database for information, so the
1565 specifiers only work as shortcuts for things which are
1566 already specified in a different way in the unit
1567 file. They are fully functional when systemd is
1568 running in <option>--user</option> mode.</para>
8afbb8e1
LP
1569 </refsect1>
1570
d1ab0ca0 1571 <refsect1>
160cd5c9
LP
1572 <title>See Also</title>
1573 <para>
1574 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
67826132 1575 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
771610b0
LP
1576 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1577 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1578 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1579 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1580 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1581 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1582 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1583 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1584 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
5f2ee303 1585 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
62590f23 1586 <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
e73eebfd
LP
1587 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1588 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
7a529f63 1589 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
0e8415f2 1590 <citerefentry><refentrytitle>systemd-verify</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
5aded369 1591 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
6aaa8c2f
ZJS
1592 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1593 <citerefentry><refentrytitle>uname</refentrytitle><manvolnum>1</manvolnum></citerefentry>
160cd5c9 1594 </para>
d1ab0ca0
LP
1595 </refsect1>
1596
1597</refentry>