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