chiark / gitweb /
b1f8108984377dd76e45e62b2dcab985d819efb3
[elogind.git] / man / systemd.unit.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3         "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
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
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
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
21   Lesser General Public License for more details.
22
23   You should have received a copy of the GNU Lesser General Public License
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>
50                 <refpurpose>Unit configuration</refpurpose>
51         </refnamediv>
52
53         <refsynopsisdiv>
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>,
63                 <filename><replaceable>snapshot</replaceable>.snapshot</filename>,
64                 <filename><replaceable>slice</replaceable>.slice</filename>,
65                 <filename><replaceable>scope</replaceable>.scope</filename></para>
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
73                 <para><literallayout><filename>$XDG_CONFIG_HOME/systemd/user/*</filename>
74 <filename>$HOME/.config/systemd/user/*</filename>
75 <filename>/etc/systemd/user/*</filename>
76 <filename>/run/systemd/user/*</filename>
77 <filename>/usr/lib/systemd/user/*</filename>
78 <filename>...</filename>
79                 </literallayout></para>
80         </refsynopsisdiv>
81
82         <refsect1>
83                 <title>Description</title>
84
85                 <para>A unit configuration file encodes information
86                 about a service, a socket, a device, a mount point, an
87                 automount point, a swap file or partition, a start-up
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
94                 url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG
95                 Desktop Entry Specification</ulink>
96                 <filename>.desktop</filename> files, which are in turn
97                 inspired by Microsoft Windows
98                 <filename>.ini</filename> files.</para>
99
100                 <para>This man page lists the common configuration
101                 options of all the unit types. These options need to
102                 be configured in the [Unit] or [Install]
103                 sections of the unit files.</para>
104
105                 <para>In addition to the generic [Unit] and [Install]
106                 sections described here, each unit may have a
107                 type-specific section, e.g. [Service] for a service
108                 unit. See the respective man pages for more
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>.
120                 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
121                 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
122                 </para>
123
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
135                 <para>Unit files are loaded from a set of paths
136                 determined during compilation, described in the next section.
137                 </para>
138
139                 <para>Unit files may contain additional options on top
140                 of those listed here. If systemd encounters an unknown
141                 option, it will write a warning log message but
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>
148
149                 <para>Boolean arguments used in unit files can be
150                 written in various formats. For positive settings the
151                 strings <option>1</option>, <option>yes</option>,
152                 <option>true</option> and <option>on</option> are
153                 equivalent. For negative settings, the strings
154                 <option>0</option>, <option>no</option>,
155                 <option>false</option> and <option>off</option> are
156                 equivalent.</para>
157
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
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
164                 seconds; "2min 200ms" refers to 2 minutes plus 200
165                 milliseconds, i.e. 120200ms. The following time units
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>
169
170                 <para>Empty lines and lines starting with # or ; are
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>
175
176                 <para>Along with a unit file
177                 <filename>foo.service</filename>, the directory
178                 <filename>foo.service.wants/</filename> may exist. All
179                 unit files symlinked from such a directory are
180                 implicitly added as dependencies of type
181                 <varname>Wanted=</varname> to the unit. This is useful
182                 to hook units into the start-up of other units,
183                 without having to modify their unit files. For details
184                 about the semantics of <varname>Wanted=</varname>, see
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
188                 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
189                 tool which reads information from the [Install]
190                 section of unit files (see below). A similar
191                 functionality exists for <varname>Requires=</varname>
192                 type dependencies as well, the directory suffix is
193                 <filename>.requires/</filename> in this case.</para>
194
195                 <para>Along with a unit file
196                 <filename>foo.service</filename>, a directory
197                 <filename>foo.service.d/</filename> may exist. All
198                 files with the suffix <literal>.conf</literal> from
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
206                 <para>Note that while systemd offers a flexible
207                 dependency system between units it is recommended to
208                 use this functionality only sparingly and instead rely
209                 on techniques such as bus-based or socket-based
210                 activation which make dependencies implicit, resulting
211                 in a both simpler and more flexible system.</para>
212
213                 <para>Some unit names reflect paths existing in the
214                 file system namespace. Example: a device unit
215                 <filename>dev-sda.device</filename> refers to a device
216                 with the device node <filename noindex='true'>/dev/sda</filename> in
217                 the file system namespace. If this applies, a special
218                 way to escape the path name is used, so that the
219                 result is usable as part of a filename. Basically,
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>
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
230                 systemd looks for a unit configuration file, it will
231                 first search for the literal unit name in the
232                 file system. If that yields no success and the unit
233                 name contains an <literal>@</literal> character, systemd will look for a
234                 unit template that shares the same name but with the
235                 instance string (i.e. the part between the <literal>@</literal> character
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
241                 it is found.</para>
242
243                 <para>To refer to the instance string from
244                 within the configuration file you may use the special
245                 <literal>%i</literal> specifier in many of the
246                 configuration options. See below for details.</para>
247
248                 <para>If a unit file is empty (i.e. has the file size
249                 0) or is symlinked to <filename>/dev/null</filename>,
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
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>
260
261         </refsect1>
262
263         <refsect1>
264                 <title>Unit Load Path</title>
265
266                 <para>Unit files are loaded from a set of paths
267                 determined during compilation, described in the two
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>
271
272                 <para>When systemd is running in user mode
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>
294                       <row>
295                         <entry><filename>/etc/systemd/system</filename></entry>
296                         <entry>Local configuration</entry>
297                       </row>
298                       <row>
299                         <entry><filename>/run/systemd/system</filename></entry>
300                         <entry>Runtime units</entry>
301                       </row>
302                       <row>
303                         <entry><filename>/usr/lib/systemd/system</filename></entry>
304                         <entry>Units of installed packages</entry>
305                       </row>
306                     </tbody>
307                   </tgroup>
308                 </table>
309
310                 <table>
311                   <title>
312                     Load path when running in user mode (<option>--user</option>).
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>
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>
329                       <row>
330                         <entry><filename>$HOME/.config/systemd/user</filename></entry>
331                         <entry>User configuration (only used when $XDG_CONFIG_HOME is not set)</entry>
332                       </row>
333                       <row>
334                         <entry><filename>/etc/systemd/user</filename></entry>
335                         <entry>Local configuration</entry>
336                       </row>
337                       <row>
338                         <entry><filename>/run/systemd/user</filename></entry>
339                         <entry>Runtime units</entry>
340                       </row>
341                       <row>
342                         <entry><filename>/usr/lib/systemd/user</filename></entry>
343                         <entry>Units of installed packages</entry>
344                       </row>
345                     </tbody>
346                   </tgroup>
347                 </table>
348
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
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>.
356                 </para>
357         </refsect1>
358
359         <refsect1>
360                 <title>[Unit] Section Options</title>
361
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
366                 <variablelist class='unit-directives'>
367
368                         <varlistentry>
369                                 <term><varname>Description=</varname></term>
370                                 <listitem><para>A free-form string
371                                 describing the unit. This is intended
372                                 for use in UIs to show descriptive
373                                 information along with the unit
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>
383                         </varlistentry>
384
385                         <varlistentry>
386                                 <term><varname>Documentation=</varname></term>
387                                 <listitem><para>A space-separated list
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
398                                 URIs, see
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
406                                 any other related documentation. This
407                                 option may be specified more than once,
408                                 in which case the specified list of
409                                 URIs is merged. If the empty string is
410                                 assigned to this option, the list is
411                                 reset and all prior assignments will
412                                 have no effect.</para></listitem>
413                         </varlistentry>
414
415                         <varlistentry>
416                                 <term><varname>Requires=</varname></term>
417
418                                 <listitem><para>Configures requirement
419                                 dependencies on other units. If this
420                                 unit gets activated, the units listed
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
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
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
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>
463                         </varlistentry>
464
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
473                                 start are ignored if the startup was
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
478                                 requested by the user, this dependency
479                                 must be fulfilled and otherwise the
480                                 transaction fails. Hence, this option
481                                 may be used to configure dependencies
482                                 that are normally honored unless the
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
493                                 <varname>Requires=</varname> and
494                                 <varname>RequiresOverridable=</varname>,
495                                 respectively. However, if the units
496                                 listed here are not started already,
497                                 they will not be started and the
498                                 transaction will fail immediately.
499                                 </para></listitem>
500                         </varlistentry>
501
502                         <varlistentry>
503                                 <term><varname>Wants=</varname></term>
504
505                                 <listitem><para>A weaker version of
506                                 <varname>Requires=</varname>. Units
507                                 listed in this option will be started
508                                 if the configuring unit is. However,
509                                 if the listed units fail to start
510                                 or cannot be added to the transaction,
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
515                                 unit.</para>
516
517                                 <para>Note that dependencies of this
518                                 type may also be configured outside of
519                                 the unit configuration file by adding
520                                 symlinks to a
521                                 <filename>.wants/</filename> directory
522                                 accompanying the unit file. For
523                                 details, see above.</para></listitem>
524                         </varlistentry>
525
526                         <varlistentry>
527                                 <term><varname>BindsTo=</varname></term>
528
529                                 <listitem><para>Configures requirement
530                                 dependencies, very similar in style to
531                                 <varname>Requires=</varname>, however
532                                 in addition to this behavior, it also
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
539                                 unmounted without involvement of
540                                 systemd.</para></listitem>
541                         </varlistentry>
542
543                         <varlistentry>
544                                 <term><varname>PartOf=</varname></term>
545
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.
552                                 Note that this is a one-way dependency —
553                                 changes to this unit do not affect the
554                                 listed units.
555                                 </para></listitem>
556                         </varlistentry>
557
558                         <varlistentry>
559                                 <term><varname>Conflicts=</varname></term>
560
561                                 <listitem><para>A space-separated list
562                                 of unit names. Configures negative
563                                 requirement dependencies. If a unit
564                                 has a <varname>Conflicts=</varname>
565                                 setting on another unit, starting the
566                                 former will stop the latter and vice
567                                 versa. Note that this setting is
568                                 independent of and orthogonal to the
569                                 <varname>After=</varname> and
570                                 <varname>Before=</varname> ordering
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
581                                 case, the job that is not the required
582                                 will be removed, or in case both are
583                                 not required, the unit that conflicts
584                                 will be started and the unit that is
585                                 conflicted is
586                                 stopped.</para></listitem>
587                         </varlistentry>
588
589                         <varlistentry>
590                                 <term><varname>Before=</varname></term>
591                                 <term><varname>After=</varname></term>
592
593                                 <listitem><para>A space-separated list
594                                 of unit names. Configures ordering
595                                 dependencies between units. If a unit
596                                 <filename>foo.service</filename>
597                                 contains a setting
598                                 <option>Before=bar.service</option>
599                                 and both units are being started,
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
610                                 <varname>Requires=</varname> option, in
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
629                                 inverse of the start-up order is
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
638                                 start-up regardless of whether the
639                                 ordering dependency is actually of
640                                 type <varname>After=</varname> or
641                                 <varname>Before=</varname>. If two
642                                 units have no ordering dependencies
643                                 between them, they are shut down or
644                                 started up simultaneously, and no
645                                 ordering takes
646                                 place. </para></listitem>
647                         </varlistentry>
648
649                         <varlistentry>
650                                 <term><varname>OnFailure=</varname></term>
651
652                                 <listitem><para>A space-separated list
653                                 of one or more units that are
654                                 activated when this unit enters the
655                                 <literal>failed</literal>
656                                 state.</para></listitem>
657                         </varlistentry>
658
659                         <varlistentry>
660                                 <term><varname>PropagatesReloadTo=</varname></term>
661                                 <term><varname>ReloadPropagatedFrom=</varname></term>
662
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>
674                         </varlistentry>
675
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
690                                 setting set is started, its processes
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
696                                 units are already started, it is not
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
707                         <varlistentry>
708                                 <term><varname>RequiresMountsFor=</varname></term>
709
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
715                                 mount units required to access the
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>
730                         </varlistentry>
731
732                         <varlistentry>
733                                 <term><varname>OnFailureJobMode=</varname></term>
734
735                                 <listitem><para>Takes a value of
736                                 <literal>fail</literal>,
737                                 <literal>replace</literal>,
738                                 <literal>replace-irreversibly</literal>,
739                                 <literal>isolate</literal>,
740                                 <literal>flush</literal>,
741                                 <literal>ignore-dependencies</literal>
742                                 or
743                                 <literal>ignore-requirements</literal>. Defaults
744                                 to
745                                 <literal>replace</literal>. Specifies
746                                 how the units listed in
747                                 <varname>OnFailure=</varname> will be
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
752                                 this is set to
753                                 <literal>isolate</literal>, only a
754                                 single unit may be listed in
755                                 <varname>OnFailure=</varname>..</para></listitem>
756                         </varlistentry>
757
758                         <varlistentry>
759                                 <term><varname>IgnoreOnIsolate=</varname></term>
760
761                                 <listitem><para>Takes a boolean
762                                 argument. If <option>true</option>,
763                                 this unit will not be stopped when
764                                 isolating another unit. Defaults to
765                                 <option>false</option>.</para></listitem>
766                         </varlistentry>
767
768                         <varlistentry>
769                                 <term><varname>IgnoreOnSnapshot=</varname></term>
770
771                                 <listitem><para>Takes a boolean
772                                 argument. If <option>true</option>,
773                                 this unit will not be included in
774                                 snapshots. Defaults to
775                                 <option>true</option> for device and
776                                 snapshot units, <option>false</option>
777                                 for the others.</para></listitem>
778                         </varlistentry>
779
780                         <varlistentry>
781                                 <term><varname>StopWhenUnneeded=</varname></term>
782
783                                 <listitem><para>Takes a boolean
784                                 argument. If <option>true</option>,
785                                 this unit will be stopped when it is
786                                 no longer used. Note that in order to
787                                 minimize the work to be executed,
788                                 systemd will not stop units by default
789                                 unless they are conflicting with other
790                                 units, or the user explicitly
791                                 requested their shut down. If this
792                                 option is set, a unit will be
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>
799                                 <term><varname>RefuseManualStart=</varname></term>
800                                 <term><varname>RefuseManualStop=</varname></term>
801
802                                 <listitem><para>Takes a boolean
803                                 argument. If <option>true</option>,
804                                 this unit can only be activated
805                                 or deactivated indirectly. In
806                                 this case, explicit start-up
807                                 or termination requested by the
808                                 user is denied, however if it is
809                                 started or stopped as a
810                                 dependency of another unit, start-up
811                                 or termination will succeed. This
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
819                                 <option>false</option>.</para></listitem>
820                         </varlistentry>
821
822                         <varlistentry>
823                                 <term><varname>AllowIsolate=</varname></term>
824
825                                 <listitem><para>Takes a boolean
826                                 argument. If <option>true</option>,
827                                 this unit may be used with the
828                                 <command>systemctl isolate</command>
829                                 command. Otherwise, this will be
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
839                         <varlistentry>
840                                 <term><varname>DefaultDependencies=</varname></term>
841
842                                 <listitem><para>Takes a boolean
843                                 argument. If <option>true</option>,
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
852                                 completed and is properly terminated on
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
861                                 <option>false</option>, this option
862                                 does not disable all implicit
863                                 dependencies, just non-essential
864                                 ones.</para></listitem>
865                         </varlistentry>
866
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
873                                 time. If this time limit is reached,
874                                 the job will be cancelled, the unit
875                                 however will not change state or even
876                                 enter the <literal>failed</literal>
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
882                                 <varname>Timeout=</varname> in service
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
887                                 are useful to abort unit state
888                                 changes, and revert them. The job
889                                 timeout set with this option however
890                                 is useful to abort only the job
891                                 waiting for the unit state to
892                                 change.</para></listitem>
893                         </varlistentry>
894
895                         <varlistentry>
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>
903                                 <term><varname>ConditionNeedsUpdate=</varname></term>
904                                 <term><varname>ConditionFirstBoot=</varname></term>
905                                 <term><varname>ConditionPathExists=</varname></term>
906                                 <term><varname>ConditionPathExistsGlob=</varname></term>
907                                 <term><varname>ConditionPathIsDirectory=</varname></term>
908                                 <term><varname>ConditionPathIsSymbolicLink=</varname></term>
909                                 <term><varname>ConditionPathIsMountPoint=</varname></term>
910                                 <term><varname>ConditionPathIsReadWrite=</varname></term>
911                                 <term><varname>ConditionDirectoryNotEmpty=</varname></term>
912                                 <term><varname>ConditionFileNotEmpty=</varname></term>
913                                 <term><varname>ConditionFileIsExecutable=</varname></term>
914                                 <term><varname>ConditionNull=</varname></term>
915
916                                 <listitem><para>Before starting a unit
917                                 verify that the specified condition is
918                                 true. If it is not true, the starting
919                                 of the unit will be skipped, however
920                                 all ordering dependencies of it are
921                                 still respected. A failing condition
922                                 will not result in the unit being
923                                 moved into a failure state. The
924                                 condition is checked at the time the
925                                 queued start job is to be
926                                 executed.</para>
927
928                                 <para><varname>ConditionArchitecture=</varname>
929                                 may be used to check whether the
930                                 system is running on a specific
931                                 architecture. Takes one of
932                                 <varname>x86</varname>,
933                                 <varname>x86-64</varname>,
934                                 <varname>ppc</varname>,
935                                 <varname>ppc-le</varname>,
936                                 <varname>ppc64</varname>,
937                                 <varname>ppc64-le</varname>,
938                                 <varname>ia64</varname>,
939                                 <varname>parisc</varname>,
940                                 <varname>parisc64</varname>,
941                                 <varname>s390</varname>,
942                                 <varname>s390x</varname>,
943                                 <varname>sparc</varname>,
944                                 <varname>sparc64</varname>,
945                                 <varname>mips</varname>,
946                                 <varname>mips-le</varname>,
947                                 <varname>mips64</varname>,
948                                 <varname>mips64-le</varname>,
949                                 <varname>alpha</varname>,
950                                 <varname>arm</varname>,
951                                 <varname>arm-be</varname>,
952                                 <varname>arm64</varname>,
953                                 <varname>arm64-be</varname>,
954                                 <varname>sh</varname>,
955                                 <varname>sh64</varname>,
956                                 <varname>m86k</varname>,
957                                 <varname>tilegx</varname>,
958                                 <varname>cris</varname> to test
959                                 against a specific architecture. The
960                                 architecture is determined from the
961                                 information returned by
962                                 <citerefentry><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry>
963                                 and is thus subject to
964                                 <citerefentry><refentrytitle>personality</refentrytitle><manvolnum>2</manvolnum></citerefentry>. Note
965                                 that a <varname>Personality=</varname>
966                                 setting in the same unit file has no
967                                 effect on this condition. A special
968                                 architecture name
969                                 <varname>native</varname> is mapped to
970                                 the architecture the system manager
971                                 itself is compiled for. The test may
972                                 be negated by prepending an
973                                 exclamation mark.</para>
974
975                                 <para><varname>ConditionVirtualization=</varname>
976                                 may be used to check whether the
977                                 system is executed in a virtualized
978                                 environment and optionally test
979                                 whether it is a specific
980                                 implementation. Takes either boolean
981                                 value to check if being executed in
982                                 any virtualized environment, or one of
983                                 <varname>vm</varname> and
984                                 <varname>container</varname> to test
985                                 against a generic type of
986                                 virtualization solution, or one of
987                                 <varname>qemu</varname>,
988                                 <varname>kvm</varname>,
989                                 <varname>vmware</varname>,
990                                 <varname>microsoft</varname>,
991                                 <varname>oracle</varname>,
992                                 <varname>xen</varname>,
993                                 <varname>bochs</varname>,
994                                 <varname>uml</varname>,
995                                 <varname>openvz</varname>,
996                                 <varname>lxc</varname>,
997                                 <varname>lxc-libvirt</varname>,
998                                 <varname>systemd-nspawn</varname> to
999                                 test against a specific
1000                                 implementation. If multiple
1001                                 virtualization technologies are nested,
1002                                 only the innermost is considered. The
1003                                 test may be negated by prepending an
1004                                 exclamation mark.</para>
1005
1006                                 <para><varname>ConditionHost=</varname>
1007                                 may be used to match against the
1008                                 hostname or machine ID of the
1009                                 host. This either takes a hostname
1010                                 string (optionally with shell style
1011                                 globs) which is tested against the
1012                                 locally set hostname as returned by
1013                                 <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
1014                                 or a machine ID formatted as string
1015                                 (see
1016                                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
1017                                 The test may be negated by prepending
1018                                 an exclamation mark.</para>
1019
1020                                 <para><varname>ConditionKernelCommandLine=</varname>
1021                                 may be used to check whether a
1022                                 specific kernel command line option is
1023                                 set (or if prefixed with the
1024                                 exclamation mark unset). The argument
1025                                 must either be a single word, or an
1026                                 assignment (i.e. two words, separated
1027                                 <literal>=</literal>). In the former
1028                                 case the kernel command line is
1029                                 searched for the word appearing as is,
1030                                 or as left hand side of an
1031                                 assignment. In the latter case, the
1032                                 exact assignment is looked for with
1033                                 right and left hand side
1034                                 matching.</para>
1035
1036                                 <para><varname>ConditionSecurity=</varname>
1037                                 may be used to check whether the given
1038                                 security module is enabled on the
1039                                 system. Currently the recognized values
1040                                 values are <varname>selinux</varname>,
1041                                 <varname>apparmor</varname>,
1042                                 <varname>ima</varname> and
1043                                 <varname>smack</varname>.
1044                                 The test may be negated by prepending
1045                                 an exclamation
1046                                 mark.</para>
1047
1048                                 <para><varname>ConditionCapability=</varname>
1049                                 may be used to check whether the given
1050                                 capability exists in the capability
1051                                 bounding set of the service manager
1052                                 (i.e. this does not check whether
1053                                 capability is actually available in
1054                                 the permitted or effective sets, see
1055                                 <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1056                                 for details). Pass a capability name
1057                                 such as <literal>CAP_MKNOD</literal>,
1058                                 possibly prefixed with an exclamation
1059                                 mark to negate the check.</para>
1060
1061                                 <para><varname>ConditionACPower=</varname>
1062                                 may be used to check whether the
1063                                 system has AC power, or is exclusively
1064                                 battery powered at the time of
1065                                 activation of the unit. This takes a
1066                                 boolean argument. If set to
1067                                 <varname>true</varname>, the condition
1068                                 will hold only if at least one AC
1069                                 connector of the system is connected
1070                                 to a power source, or if no AC
1071                                 connectors are known. Conversely, if
1072                                 set to <varname>false</varname>, the
1073                                 condition will hold only if there is
1074                                 at least one AC connector known and
1075                                 all AC connectors are disconnected
1076                                 from a power source.</para>
1077
1078                                 <para><varname>ConditionNeedsUpdate=</varname>
1079                                 takes one of <filename>/var</filename>
1080                                 or <filename>/etc</filename> as
1081                                 argument, possibly prefixed with a
1082                                 <literal>!</literal> (for inverting
1083                                 the condition). This condition may be
1084                                 used to conditionalize units on
1085                                 whether the specified directory
1086                                 requires an update because
1087                                 <filename>/usr</filename>'s
1088                                 modification time is newer than the
1089                                 stamp file
1090                                 <filename>.updated</filename> in the
1091                                 specified directory. This is useful to
1092                                 implement offline updates of the
1093                                 vendor operating system resources in
1094                                 <filename>/usr</filename> that require
1095                                 updating of <filename>/etc</filename>
1096                                 or <filename>/var</filename> on the
1097                                 next following boot. Units making use
1098                                 of this condition should order
1099                                 themselves before
1100                                 <citerefentry><refentrytitle>systemd-update-done.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1101                                 to make sure they run before the stamp
1102                                 files's modification time gets reset
1103                                 indicating a completed update.</para>
1104
1105                                 <para><varname>ConditionFirstBoot=</varname>
1106                                 takes a boolean argument. This
1107                                 condition may be used to
1108                                 conditionalize units on whether the
1109                                 system is booting up with an
1110                                 unpopulated <filename>/etc</filename>
1111                                 directory. This may be used to
1112                                 populate <filename>/etc</filename> on
1113                                 the first boot after factory reset, or
1114                                 when a new system instances boots up
1115                                 for the first time.</para>
1116
1117                                 <para>With
1118                                 <varname>ConditionPathExists=</varname>
1119                                 a file existence condition is
1120                                 checked before a unit is started. If
1121                                 the specified absolute path name does
1122                                 not exist, the condition will
1123                                 fail. If the absolute path name passed
1124                                 to
1125                                 <varname>ConditionPathExists=</varname>
1126                                 is prefixed with an exclamation mark
1127                                 (<literal>!</literal>), the test is negated, and the unit
1128                                 is only started if the path does not
1129                                 exist.</para>
1130
1131                                 <para><varname>ConditionPathExistsGlob=</varname>
1132                                 is similar to
1133                                 <varname>ConditionPathExists=</varname>,
1134                                 but checks for the existence of at
1135                                 least one file or directory matching
1136                                 the specified globbing pattern.</para>
1137
1138                                 <para><varname>ConditionPathIsDirectory=</varname>
1139                                 is similar to
1140                                 <varname>ConditionPathExists=</varname>
1141                                 but verifies whether a certain path
1142                                 exists and is a
1143                                 directory.</para>
1144
1145                                 <para><varname>ConditionPathIsSymbolicLink=</varname>
1146                                 is similar to
1147                                 <varname>ConditionPathExists=</varname>
1148                                 but verifies whether a certain path
1149                                 exists and is a symbolic
1150                                 link.</para>
1151
1152                                 <para><varname>ConditionPathIsMountPoint=</varname>
1153                                 is similar to
1154                                 <varname>ConditionPathExists=</varname>
1155                                 but verifies whether a certain path
1156                                 exists and is a mount
1157                                 point.</para>
1158
1159                                 <para><varname>ConditionPathIsReadWrite=</varname>
1160                                 is similar to
1161                                 <varname>ConditionPathExists=</varname>
1162                                 but verifies whether the underlying
1163                                 file system is readable and writable
1164                                 (i.e. not mounted
1165                                 read-only).</para>
1166
1167                                 <para><varname>ConditionDirectoryNotEmpty=</varname>
1168                                 is similar to
1169                                 <varname>ConditionPathExists=</varname>
1170                                 but verifies whether a certain path
1171                                 exists and is a non-empty
1172                                 directory.</para>
1173
1174                                 <para><varname>ConditionFileNotEmpty=</varname>
1175                                 is similar to
1176                                 <varname>ConditionPathExists=</varname>
1177                                 but verifies whether a certain path
1178                                 exists and refers to a regular file
1179                                 with a non-zero size.</para>
1180
1181                                 <para><varname>ConditionFileIsExecutable=</varname>
1182                                 is similar to
1183                                 <varname>ConditionPathExists=</varname>
1184                                 but verifies whether a certain path
1185                                 exists, is a regular file and marked
1186                                 executable.</para>
1187
1188                                 <para>Finally,
1189                                 <varname>ConditionNull=</varname> may
1190                                 be used to add a constant condition
1191                                 check value to the unit. It takes a
1192                                 boolean argument. If set to
1193                                 <varname>false</varname>, the condition
1194                                 will always fail, otherwise
1195                                 succeed.</para>
1196
1197                                 <para>If multiple conditions are
1198                                 specified, the unit will be executed if
1199                                 all of them apply (i.e. a logical AND
1200                                 is applied). Condition checks can be
1201                                 prefixed with a pipe symbol (|) in
1202                                 which case a condition becomes a
1203                                 triggering condition. If at least one
1204                                 triggering condition is defined for a
1205                                 unit, then the unit will be executed if
1206                                 at least one of the triggering
1207                                 conditions apply and all of the
1208                                 non-triggering conditions. If you
1209                                 prefix an argument with the pipe
1210                                 symbol and an exclamation mark, the
1211                                 pipe symbol must be passed first, the
1212                                 exclamation second. Except for
1213                                 <varname>ConditionPathIsSymbolicLink=</varname>,
1214                                 all path checks follow symlinks. If
1215                                 any of these options is assigned the
1216                                 empty string, the list of conditions is
1217                                 reset completely, all previous
1218                                 condition settings (of any kind) will
1219                                 have no effect.</para></listitem>
1220                         </varlistentry>
1221
1222                         <varlistentry>
1223                                 <term><varname>SourcePath=</varname></term>
1224                                 <listitem><para>A path to a
1225                                 configuration file this unit has been
1226                                 generated from. This is primarily
1227                                 useful for implementation of generator
1228                                 tools that convert configuration from
1229                                 an external configuration file format
1230                                 into native unit files. This
1231                                 functionality should not be used in
1232                                 normal units.</para></listitem>
1233                         </varlistentry>
1234                 </variablelist>
1235
1236         </refsect1>
1237
1238         <refsect1>
1239                 <title>[Install] Section Options</title>
1240
1241                 <para>Unit file may include a [Install] section, which
1242                 carries installation information for the unit. This
1243                 section is not interpreted by
1244                 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1245                 during runtime. It is used exclusively by the
1246                 <command>enable</command> and
1247                 <command>disable</command> commands of the
1248                 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1249                 tool during installation of a unit:</para>
1250
1251                 <variablelist class='unit-directives'>
1252                         <varlistentry>
1253                                 <term><varname>Alias=</varname></term>
1254
1255                                 <listitem><para>A space-seperated list
1256                                 of additional names this unit shall be
1257                                 installed under. The names listed here
1258                                 must have the same suffix (i.e. type)
1259                                 as the unit file name. This option may
1260                                 be specified more than once, in which
1261                                 case all listed names are used. At
1262                                 installation time, <command>systemctl
1263                                 enable</command> will create symlinks
1264                                 from these names to the unit
1265                                 filename.</para></listitem>
1266                         </varlistentry>
1267
1268                         <varlistentry>
1269                                 <term><varname>WantedBy=</varname></term>
1270                                 <term><varname>RequiredBy=</varname></term>
1271
1272                                 <listitem><para>This option may be
1273                                 used more than once, or a
1274                                 space-separated list of unit names may
1275                                 be given. A symbolic link is created
1276                                 in the <filename>.wants/</filename> or
1277                                 <filename>.requires/</filename>
1278                                 directory of each of the listed units
1279                                 when this unit is installed by
1280                                 <command>systemctl enable</command>.
1281                                 This has the effect that a dependency
1282                                 of type <varname>Wants=</varname> or
1283                                 <varname>Requires=</varname> is added
1284                                 from the listed unit to the current
1285                                 unit. The primary result is that the
1286                                 current unit will be started when the
1287                                 listed unit is started. See the
1288                                 description of
1289                                 <varname>Wants=</varname> and
1290                                 <varname>Requires=</varname> in the
1291                                 [Unit] section for details.</para>
1292
1293                                 <para><command>WantedBy=foo.service</command>
1294                                 in a service
1295                                 <filename>bar.service</filename> is
1296                                 mostly equivalent to
1297                                 <command>Alias=foo.service.wants/bar.service</command>
1298                                 in the same file. In case of template
1299                                 units, <command>systemctl enable</command>
1300                                 must be called with an instance name, and
1301                                 this instance will be added to the
1302                                 <filename>.wants/</filename> or
1303                                 <filename>.requires/</filename> list
1304                                 of the listed unit.
1305                                 E.g. <command>WantedBy=getty.target</command>
1306                                 in a service
1307                                 <filename>getty@.service</filename>
1308                                 will result in <command>systemctl
1309                                 enable getty@tty2.service</command>
1310                                 creating a
1311                                 <filename>getty.target.wants/getty@tty2.service</filename>
1312                                 link to <filename>getty@.service</filename>.
1313                                 </para></listitem>
1314                         </varlistentry>
1315
1316                         <varlistentry>
1317                                 <term><varname>Also=</varname></term>
1318
1319                                 <listitem><para>Additional units to
1320                                 install/deinstall when this unit is
1321                                 installed/deinstalled. If the user
1322                                 requests installation/deinstallation
1323                                 of a unit with this option configured,
1324                                 <command>systemctl enable</command>
1325                                 and <command>systemctl
1326                                 disable</command> will automatically
1327                                 install/uninstall units listed in this option as
1328                                 well.</para>
1329
1330                                 <para>This option may be used more
1331                                 than once, or a space-separated list
1332                                 of unit names may be
1333                                 given.</para></listitem>
1334                         </varlistentry>
1335
1336                         <varlistentry>
1337                                 <term><varname>DefaultInstance=</varname></term>
1338
1339                                 <listitem><para>In template unit files,
1340                                 this specifies for which instance the
1341                                 unit shall be enabled if the template
1342                                 is enabled without any explicitly set
1343                                 instance. This option has no effect in
1344                                 non-template unit files. The specified
1345                                 string must be usable as instance
1346                                 identifier.</para></listitem>
1347                         </varlistentry>
1348                 </variablelist>
1349
1350                 <para>The following specifiers are interpreted in the
1351                 Install section: %n, %N, %p, %i, %U, %u, %m, %H, %b, %v.
1352                 For their meaning see the next section.
1353                 </para>
1354         </refsect1>
1355
1356         <refsect1>
1357                 <title>Specifiers</title>
1358
1359                 <para>Many settings resolve specifiers which may be
1360                 used to write generic unit files referring to runtime
1361                 or unit parameters that are replaced when the unit
1362                 files are loaded. The following specifiers are
1363                 understood:</para>
1364
1365                 <table>
1366                   <title>Specifiers available in unit files</title>
1367                   <tgroup cols='3' align='left' colsep='1' rowsep='1'>
1368                     <colspec colname="spec" />
1369                     <colspec colname="mean" />
1370                     <colspec colname="detail" />
1371                     <thead>
1372                       <row>
1373                         <entry>Specifier</entry>
1374                         <entry>Meaning</entry>
1375                         <entry>Details</entry>
1376                       </row>
1377                     </thead>
1378                     <tbody>
1379                       <row>
1380                         <entry><literal>%n</literal></entry>
1381                         <entry>Full unit name</entry>
1382                         <entry></entry>
1383                       </row>
1384                       <row>
1385                         <entry><literal>%N</literal></entry>
1386                         <entry>Unescaped full unit name</entry>
1387                         <entry>Same as <literal>%n</literal>, but with escaping undone</entry>
1388                       </row>
1389                       <row>
1390                         <entry><literal>%p</literal></entry>
1391                         <entry>Prefix name</entry>
1392                         <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>
1393                       </row>
1394                       <row>
1395                         <entry><literal>%P</literal></entry>
1396                         <entry>Unescaped prefix name</entry>
1397                         <entry>Same as <literal>%p</literal>, but with escaping undone</entry>
1398                       </row>
1399                       <row>
1400                         <entry><literal>%i</literal></entry>
1401                         <entry>Instance name</entry>
1402                         <entry>For instantiated units: this is the string between the <literal>@</literal> character and the suffix of the unit name.</entry>
1403                       </row>
1404                       <row>
1405                         <entry><literal>%I</literal></entry>
1406                         <entry>Unescaped instance name</entry>
1407                         <entry>Same as <literal>%i</literal>, but with escaping undone</entry>
1408                       </row>
1409                       <row>
1410                         <entry><literal>%f</literal></entry>
1411                         <entry>Unescaped filename</entry>
1412                         <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>
1413                       </row>
1414                       <row>
1415                         <entry><literal>%c</literal></entry>
1416                         <entry>Control group path of the unit</entry>
1417                         <entry>This path does not include the <filename>/sys/fs/cgroup/systemd/</filename> prefix.</entry>
1418                       </row>
1419                       <row>
1420                         <entry><literal>%r</literal></entry>
1421                         <entry>Control group path of the slice the unit is placed in</entry>
1422                         <entry>This usually maps to the parent cgroup path of <literal>%c</literal>.</entry>
1423                       </row>
1424                       <row>
1425                         <entry><literal>%R</literal></entry>
1426                         <entry>Root control group path below which slices and units are placed</entry>
1427                         <entry>For system instances, this resolves to <filename>/</filename>, except in containers, where this maps to the container's root control group path.</entry>
1428                       </row>
1429                       <row>
1430                         <entry><literal>%t</literal></entry>
1431                         <entry>Runtime directory</entry>
1432                         <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>
1433                       </row>
1434                       <row>
1435                         <entry><literal>%u</literal></entry>
1436                         <entry>User name</entry>
1437                         <entry>This is the name of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
1438                       </row>
1439                       <row>
1440                         <entry><literal>%U</literal></entry>
1441                         <entry>User UID</entry>
1442                         <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>
1443                       </row>
1444                       <row>
1445                         <entry><literal>%h</literal></entry>
1446                         <entry>User home directory</entry>
1447                         <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>
1448                       </row>
1449                       <row>
1450                         <entry><literal>%s</literal></entry>
1451                         <entry>User shell</entry>
1452                         <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>
1453                       </row>
1454                       <row>
1455                         <entry><literal>%m</literal></entry>
1456                         <entry>Machine ID</entry>
1457                         <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>
1458                       </row>
1459                       <row>
1460                         <entry><literal>%b</literal></entry>
1461                         <entry>Boot ID</entry>
1462                         <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
1463                       </row>
1464                       <row>
1465                         <entry><literal>%H</literal></entry>
1466                         <entry>Host name</entry>
1467                         <entry>The hostname of the running system at the point in time the unit configuation is loaded.</entry>
1468                       </row>
1469                       <row>
1470                         <entry><literal>%v</literal></entry>
1471                         <entry>Kernel release</entry>
1472                         <entry>Identical to <command>uname -r</command> output</entry>
1473                       </row>
1474                       <row>
1475                         <entry><literal>%%</literal></entry>
1476                         <entry>Single percent sign</entry>
1477                         <entry>Use <literal>%%</literal> in place of <literal>%</literal> to specify a single percent sign.</entry>
1478                       </row>
1479                     </tbody>
1480                   </tgroup>
1481                 </table>
1482         </refsect1>
1483
1484         <refsect1>
1485                 <title>See Also</title>
1486                 <para>
1487                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1488                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1489                         <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1490                         <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1491                         <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1492                         <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1493                         <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1494                         <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1495                         <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1496                         <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1497                         <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1498                         <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1499                         <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1500                         <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1501                         <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1502                         <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1503                         <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1504                         <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1505                         <citerefentry><refentrytitle>uname</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1506                 </para>
1507         </refsect1>
1508
1509 </refentry>