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