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