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