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