]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.unit.xml
Reword sentences that contain psuedo-English "resp."
[thirdparty/systemd.git] / man / systemd.unit.xml
CommitLineData
d1ab0ca0
LP
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
d1ab0ca0
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
d1ab0ca0 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
d1ab0ca0
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="systemd.unit">
25
26 <refentryinfo>
27 <title>systemd.unit</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd.unit</refentrytitle>
42 <manvolnum>5</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd.unit</refname>
34511ca7 47 <refpurpose>Unit configuration</refpurpose>
d1ab0ca0
LP
48 </refnamediv>
49
50 <refsynopsisdiv>
11e29955
LP
51 <para><filename>systemd.service</filename>,
52 <filename>systemd.socket</filename>,
53 <filename>systemd.device</filename>,
54 <filename>systemd.mount</filename>,
55 <filename>systemd.automount</filename>,
56 <filename>systemd.swap</filename>,
57 <filename>systemd.target</filename>,
58 <filename>systemd.path</filename>,
5f2ee303
LP
59 <filename>systemd.timer</filename>,
60 <filename>systemd.snapshot</filename></para>
d1ab0ca0
LP
61 </refsynopsisdiv>
62
63 <refsect1>
64 <title>Description</title>
65
66 <para>A unit configuration file encodes information
771610b0 67 about a service, a socket, a device, a mount point, an
436c44a5 68 automount point, a swap file or partition, a start-up
771610b0 69 target, a file system path or a timer controlled and
11e29955
LP
70 supervised by
71 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>. The
72 syntax is inspired by <ulink
73 url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG
4176e530 74 Desktop Entry Specification</ulink> <filename>.desktop</filename> files, which are in turn
11e29955
LP
75 inspired by Microsoft Windows
76 <filename>.ini</filename> files.</para>
d1ab0ca0
LP
77
78 <para>This man pages lists the common configuration
58c16a1a 79 options of all the unit types. These options need to
16dad32e
AE
80 be configured in the [Unit] or [Install]
81 sections of the unit files.</para>
11e29955
LP
82
83 <para>In addition to the generic [Unit] and [Install]
58c16a1a 84 sections described here, each unit should have a
11e29955
LP
85 type-specific section, e.g. [Service] for a service
86 unit. See the respective man pages for more
87 information.</para>
88
89 <para>Unit files may contain additional options on top
90 of those listed here. If systemd encounters an unknown
91 option it will write a warning log message but
92 continue loading the unit. If an option is prefixed
93 with <option>X-</option> it is ignored completely by
94 systemd. Applications may use this to include
95 additional information in the unit files.</para>
96
97 <para>Boolean arguments used in unit files can be
6cbdbc5f 98 written in various formats. For positive settings the
11e29955
LP
99 strings <option>1</option>, <option>yes</option>,
100 <option>true</option> and <option>on</option> are
101 equivalent. For negative settings the strings
102 <option>0</option>, <option>no</option>,
103 <option>false</option> and <option>off</option> are
104 equivalent.</para>
105
0d624a78
LP
106 <para>Time span values encoded in unit files can be
107 written in various formats. A stand-alone number
108 specifies a time in seconds. If suffixed with a time
b439c6ee 109 unit, the unit is honored. A concatenation of
58c16a1a 110 multiple values with units is supported, in which case
0d624a78
LP
111 the values are added up. Example: "50" refers to 50
112 seconds; "2min 200ms" refers to 2 minutes plus 200
113 milliseconds, i.e. 120200ms. The following time units
114 are understood: s, min, h, d, w, ms, us.</para>
115
11e29955 116 <para>Empty lines and lines starting with # or ; are
b3eaa628
LP
117 ignored. This may be used for commenting. Lines ending
118 in a backslash are concatenated with the following
119 line while reading and the backslash is replaced by a
120 space character. This may be used to wrap long lines.</para>
11e29955
LP
121
122 <para>If a line starts with <option>.include</option>
58c16a1a 123 followed by a file name, the specified file will be
a70d9a77 124 parsed at this point. Make sure that the file that is
dc786b29 125 included has the appropriate section headers before
a70d9a77 126 any directives.</para>
11e29955
LP
127
128 <para>Along with a unit file
129 <filename>foo.service</filename> a directory
130 <filename>foo.service.wants/</filename> may exist. All
131 units symlinked from such a directory are implicitly
132 added as dependencies of type
133 <varname>Wanted=</varname> to the unit. This is useful
134 to hook units into the start-up of other units,
135 without having to modify their unit configuration
136 files. For details about the semantics of
137 <varname>Wanted=</varname> see below. The preferred
138 way to create symlinks in the
139 <filename>.wants/</filename> directory of a service is
ee5762e3
LP
140 with the <command>enable</command> command of the
141 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
11e29955 142 tool which reads information from the [Install]
0732ec00
LP
143 section of unit files. (See below.) A similar
144 functionality exists for <varname>Requires=</varname>
145 type dependencies as well, the directory suffix is
146 <filename>.requires/</filename> in this case.</para>
11e29955
LP
147
148 <para>Note that while systemd offers a flexible
149 dependency system between units it is recommended to
150 use this functionality only sparsely and instead rely
151 on techniques such as bus-based or socket-based
152 activation which makes dependencies implicit, which
153 both results in a simpler and more flexible
154 system.</para>
1f812fea
LP
155
156 <para>Some unit names reflect paths existing in the
157 file system name space. Example: a device unit
158 <filename>dev-sda.device</filename> refers to a device
159 with the device node <filename>/dev/sda</filename> in
160 the file system namespace. If this applies a special
085b94ee
LP
161 way to escape the path name is used, so that the
162 result is usable as part of a file name. Basically,
163 given a path, "/" is replaced by "-", and all
164 unprintable characters and the "-" are replaced by
165 C-style "\x20" escapes. The root directory "/" is
166 encoded as single dash, while otherwise the initial
167 and ending "/" is removed from all paths during
168 transformation. This escaping is reversible.</para>
1f812fea
LP
169
170 <para>Optionally, units may be instantiated from a
171 template file at runtime. This allows creation of
172 multiple units from a single configuration file. If
173 systemd looks for a unit configuration file it will
174 first search for the literal unit name in the
175 filesystem. If that yields no success and the unit
176 name contains an @ character, systemd will look for a
177 unit template that shares the same name but with the
178 instance string (i.e. the part between the @ character
179 and the suffix) removed. Example: if a service
180 <filename>getty@tty3.service</filename> is requested
181 and no file by that name is found, systemd will look
182 for <filename>getty@.service</filename> and
183 instantiate a service from that configuration file if
0e89268b
MB
184 it is found.</para>
185
186 <para>To refer to the instance string from
1f812fea
LP
187 within the configuration file you may use the special
188 <literal>%i</literal> specifier in many of the
0e89268b
MB
189 configuration options. Other specifiers exist, the
190 full list is:</para>
191
192 <table>
193 <title>Specifiers available in unit files</title>
194 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
195 <colspec colname="spec" />
196 <colspec colname="mean" />
197 <colspec colname="detail" />
198 <thead>
199 <row>
200 <entry>Specifier</entry>
201 <entry>Meaning</entry>
202 <entry>Details</entry>
203 </row>
204 </thead>
205 <tbody>
206 <row>
207 <entry><literal>%n</literal></entry>
208 <entry>Full unit name</entry>
209 <entry></entry>
210 </row>
211 <row>
212 <entry><literal>%N</literal></entry>
213 <entry>Unescaped full unit name</entry>
214 <entry></entry>
215 </row>
216 <row>
217 <entry><literal>%p</literal></entry>
218 <entry>Prefix name</entry>
219 <entry>This refers to the string before the @, i.e. "getty" in the example above, where "tty3" is the instance name.</entry>
220 </row>
221 <row>
222 <entry><literal>%P</literal></entry>
223 <entry>Unescaped prefix name</entry>
224 <entry></entry>
225 </row>
226 <row>
227 <entry><literal>%i</literal></entry>
228 <entry>Instance name</entry>
229 <entry>This is the string between the @ character and the suffix.</entry>
230 </row>
231 <row>
232 <entry><literal>%I</literal></entry>
233 <entry>Unescaped instance name</entry>
234 <entry></entry>
235 </row>
236 <row>
237 <entry><literal>%f</literal></entry>
238 <entry>Unescaped file name</entry>
239 <entry>This is either the unescaped instance name (if set) with / prepended (if necessary), or the prefix name similarly prepended with /.</entry>
240 </row>
241 <row>
242 <entry><literal>%c</literal></entry>
243 <entry>Control group path of the unit</entry>
244 <entry></entry>
245 </row>
246 <row>
247 <entry><literal>%r</literal></entry>
248 <entry>Root control group path of systemd</entry>
249 <entry></entry>
250 </row>
251 <row>
252 <entry><literal>%R</literal></entry>
253 <entry>Parent directory of the root control group path of systemd</entry>
254 <entry></entry>
255 </row>
256 <row>
257 <entry><literal>%t</literal></entry>
258 <entry>Runtime socket dir</entry>
259 <entry>This is either /run (for the system manager) or $XDG_RUNTIME_DIR (for user managers).</entry>
260 </row>
b2896c90
AK
261 <row>
262 <entry><literal>%u</literal></entry>
263 <entry>User name</entry>
264 <entry>This is the name of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
265 </row>
266 <row>
267 <entry><literal>%h</literal></entry>
268 <entry>User home directory</entry>
269 <entry>This is the home directory of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
270 </row>
d05c5031
LP
271 <row>
272 <entry><literal>%s</literal></entry>
273 <entry>User shell</entry>
274 <entry>This is the shell of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
275 </row>
6569cae1
LP
276 <row>
277 <entry><literal>%m</literal></entry>
278 <entry>Machine ID</entry>
279 <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>
280 </row>
281 <row>
282 <entry><literal>%b</literal></entry>
283 <entry>Boot ID</entry>
284 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
285 </row>
286 <row>
287 <entry><literal>%H</literal></entry>
288 <entry>Host name</entry>
289 <entry>The host name of the running system.</entry>
290 </row>
0e89268b
MB
291 </tbody>
292 </tgroup>
293 </table>
b9aea954 294
6daf4f90
LP
295 <para>If a unit file is empty (i.e. has the file size
296 0) or is symlinked to <filename>/dev/null</filename>
297 its configuration will not be loaded and it appears
298 with a load state of <literal>masked</literal>, and
299 cannot be activated. Use this as an effective way to
300 fully disable a unit, making it impossible to start it
301 even manually.</para>
302
b9aea954
LP
303 <para>The unit file format is covered by the
304 <ulink
305 url="http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface
306 Stability Promise</ulink>.</para>
d1ab0ca0
LP
307 </refsect1>
308
309 <refsect1>
310 <title>Options</title>
311
771610b0
LP
312 <para>Unit file may include a [Unit] section, which
313 carries generic information about the unit that is not
314 dependent on the type of unit:</para>
315
d1ab0ca0 316 <variablelist>
11e29955
LP
317
318 <varlistentry>
319 <term><varname>Description=</varname></term>
320 <listitem><para>A free-form string
62adf224
LP
321 describing the unit. This is intended
322 for use in UIs to show descriptive
323 information along with the unit
324 name.</para></listitem>
11e29955
LP
325 </varlistentry>
326
49dbfa7b
LP
327 <varlistentry>
328 <term><varname>Documentation=</varname></term>
329 <listitem><para>A space separated list
330 of URIs referencing documentation for
331 this unit or its
332 configuration. Accepted are only URIs
333 of the types
334 <literal>http://</literal>,
335 <literal>https://</literal>,
336 <literal>file:</literal>,
337 <literal>info:</literal>,
338 <literal>man:</literal>. For more
339 information about the syntax of these
340 URIs see
341 <citerefentry><refentrytitle>uri</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para></listitem>
342 </varlistentry>
343
d1ab0ca0 344 <varlistentry>
9f235308 345 <term><varname>Requires=</varname></term>
771610b0 346
11e29955 347 <listitem><para>Configures requirement
771610b0 348 dependencies on other units. If this
58c16a1a 349 unit gets activated, the units listed
771610b0
LP
350 here will be activated as well. If one
351 of the other units gets deactivated or
352 its activation fails, this unit will
353 be deactivated. This option may be
354 specified more than once, in which
355 case requirement dependencies for all
11e29955
LP
356 listed names are created. Note that
357 requirement dependencies do not
358 influence the order in which services
359 are started or stopped. This has to be
360 configured independently with the
361 <varname>After=</varname> or
362 <varname>Before=</varname> options. If
363 a unit
364 <filename>foo.service</filename>
365 requires a unit
366 <filename>bar.service</filename> as
367 configured with
368 <varname>Requires=</varname> and no
369 ordering is configured with
370 <varname>After=</varname> or
371 <varname>Before=</varname>, then both
372 units will be started simultaneously
373 and without any delay between them if
374 <filename>foo.service</filename> is
375 activated. Often it is a better choice
376 to use <varname>Wants=</varname>
377 instead of
378 <varname>Requires=</varname> in order
379 to achieve a system that is more
380 robust when dealing with failing
5c315b4f
ZJS
381 services.</para>
382
383 <para>Note that dependencies of this
384 type may also be configured outside of
385 the unit configuration file by
386 adding a symlink to a
387 <filename>.requires/</filename> directory
388 accompanying the unit file. For
389 details see above.</para></listitem>
d1ab0ca0 390 </varlistentry>
11e29955 391
11e29955
LP
392 <varlistentry>
393 <term><varname>RequiresOverridable=</varname></term>
394
395 <listitem><para>Similar to
396 <varname>Requires=</varname>.
397 Dependencies listed in
398 <varname>RequiresOverridable=</varname>
399 which cannot be fulfilled or fail to
58c16a1a 400 start are ignored if the startup was
11e29955
LP
401 explicitly requested by the user. If
402 the start-up was pulled in indirectly
403 by some dependency or automatic
404 start-up of units that is not
405 requested by the user this dependency
406 must be fulfilled and otherwise the
407 transaction fails. Hence, this option
408 may be used to configure dependencies
4176e530 409 that are normally honored unless the
11e29955
LP
410 user explicitly starts up the unit, in
411 which case whether they failed or not
412 is irrelevant.</para></listitem>
413
414 </varlistentry>
415 <varlistentry>
416 <term><varname>Requisite=</varname></term>
417 <term><varname>RequisiteOverridable=</varname></term>
418
419 <listitem><para>Similar to
420 <varname>Requires=</varname>
16dad32e 421 and <varname>RequiresOverridable=</varname>, respectively. However,
11e29955
LP
422 if a unit listed here is not started
423 already it will not be started and the
424 transaction fails
425 immediately.</para></listitem>
426 </varlistentry>
427
428 <varlistentry>
429 <term><varname>Wants=</varname></term>
430
431 <listitem><para>A weaker version of
432 <varname>Requires=</varname>. A unit
433 listed in this option will be started
434 if the configuring unit is. However,
58c16a1a 435 if the listed unit fails to start up
11e29955
LP
436 or cannot be added to the transaction
437 this has no impact on the validity of
438 the transaction as a whole. This is
439 the recommended way to hook start-up
440 of one unit to the start-up of another
5c315b4f
ZJS
441 unit.</para>
442
443 <para>Note that dependencies of this
11e29955
LP
444 type may also be configured outside of
445 the unit configuration file by
446 adding a symlink to a
447 <filename>.wants/</filename> directory
448 accompanying the unit file. For
449 details see above.</para></listitem>
450 </varlistentry>
451
b81884e7 452 <varlistentry>
7f2cddae 453 <term><varname>BindsTo=</varname></term>
b81884e7
LP
454
455 <listitem><para>Configures requirement
456 dependencies, very similar in style to
457 <varname>Requires=</varname>, however
c5315881 458 in addition to this behavior it also
b81884e7
LP
459 declares that this unit is stopped
460 when any of the units listed suddenly
461 disappears. Units can suddenly,
462 unexpectedly disappear if a service
463 terminates on its own choice, a device
464 is unplugged or a mount point
21931dbe 465 unmounted without involvement of
b81884e7
LP
466 systemd.</para></listitem>
467 </varlistentry>
468
85e9a101
MS
469 <varlistentry>
470 <term><varname>PartOf=</varname></term>
471
f3d52e8c
MS
472 <listitem><para>Configures dependencies
473 similar to <varname>Requires=</varname>,
474 but limited to stopping and restarting
475 of units. When systemd stops or restarts
476 the units listed here, the action is
477 propagated to this unit.
478 Note that this is a one way dependency -
479 changes to this unit do not affect the
480 listed units.
481 </para></listitem>
85e9a101
MS
482 </varlistentry>
483
11e29955
LP
484 <varlistentry>
485 <term><varname>Conflicts=</varname></term>
486
487 <listitem><para>Configures negative
488 requirement dependencies. If a unit
58c16a1a 489 has a
11e29955 490 <varname>Conflicts=</varname> setting
58c16a1a 491 on another unit, starting the former
11e29955
LP
492 will stop the latter and vice
493 versa. Note that this setting is
494 independent of and orthogonal to the
495 <varname>After=</varname> and
496 <varname>Before=</varname> ordering
69dd2852
LP
497 dependencies.</para>
498
499 <para>If a unit A that conflicts with
500 a unit B is scheduled to be started at
501 the same time as B, the transaction
502 will either fail (in case both are
503 required part of the transaction) or
504 be modified to be fixed (in case one
505 or both jobs are not a required part
506 of the transaction). In the latter
507 case the job that is not the required
508 will be removed, or in case both are
509 not required the unit that conflicts
510 will be started and the unit that is
511 conflicted is
512 stopped.</para></listitem>
11e29955
LP
513 </varlistentry>
514
515 <varlistentry>
516 <term><varname>Before=</varname></term>
517 <term><varname>After=</varname></term>
518
519 <listitem><para>Configures ordering
520 dependencies between units. If a unit
521 <filename>foo.service</filename>
522 contains a setting
523 <option>Before=bar.service</option>
58c16a1a 524 and both units are being started,
11e29955
LP
525 <filename>bar.service</filename>'s
526 start-up is delayed until
527 <filename>foo.service</filename> is
528 started up. Note that this setting is
529 independent of and orthogonal to the
530 requirement dependencies as configured
531 by <varname>Requires=</varname>. It is
532 a common pattern to include a unit
533 name in both the
534 <varname>After=</varname> and
535 <varname>Requires=</varname> option in
536 which case the unit listed will be
537 started before the unit that is
538 configured with these options. This
539 option may be specified more than
540 once, in which case ordering
541 dependencies for all listed names are
542 created. <varname>After=</varname> is
543 the inverse of
544 <varname>Before=</varname>, i.e. while
545 <varname>After=</varname> ensures that
546 the configured unit is started after
547 the listed unit finished starting up,
548 <varname>Before=</varname> ensures the
549 opposite, i.e. that the configured
550 unit is fully started up before the
551 listed unit is started. Note that when
552 two units with an ordering dependency
553 between them are shut down, the
58c16a1a 554 inverse of the start-up order is
11e29955
LP
555 applied. i.e. if a unit is configured
556 with <varname>After=</varname> on
557 another unit, the former is stopped
558 before the latter if both are shut
559 down. If one unit with an ordering
560 dependency on another unit is shut
561 down while the latter is started up,
562 the shut down is ordered before the
563 start-up regardless whether the
564 ordering dependency is actually of
565 type <varname>After=</varname> or
566 <varname>Before=</varname>. If two
567 units have no ordering dependencies
568 between them they are shut down
16dad32e 569 or started up simultaneously, and
11e29955
LP
570 no ordering takes
571 place. </para></listitem>
572 </varlistentry>
573
b9975629
LP
574 <varlistentry>
575 <term><varname>OnFailure=</varname></term>
576
577 <listitem><para>Lists one or more
578 units that are activated when this
74ac3cbd
MM
579 unit enters the
580 '<literal>failed</literal>'
581 state.</para></listitem>
b9975629
LP
582 </varlistentry>
583
4dcc1cb4 584 <varlistentry>
7f2cddae
LP
585 <term><varname>PropagatesReloadTo=</varname></term>
586 <term><varname>ReloadPropagatedFrom=</varname></term>
4dcc1cb4
LP
587
588 <listitem><para>Lists one or more
589 units where reload requests on the
590 unit will be propagated to/on the
591 other unit will be propagated
592 from. Issuing a reload request on a
593 unit will automatically also enqueue a
594 reload request on all units that the
595 reload request shall be propagated to
596 via these two
597 settings.</para></listitem>
598 </varlistentry>
599
7c8fa05c
LP
600 <varlistentry>
601 <term><varname>RequiresMountsFor=</varname></term>
602
603 <listitem><para>Takes a space
c0d6e764 604 separated list of absolute paths. Automatically
7c8fa05c
LP
605 adds dependencies of type
606 <varname>Requires=</varname> and
607 <varname>After=</varname> for all
608 mount units required to access the
609 specified path.</para></listitem>
610 </varlistentry>
611
222ae6a8
LP
612 <varlistentry>
613 <term><varname>OnFailureIsolate=</varname></term>
614
615 <listitem><para>Takes a boolean
616 argument. If <option>true</option> the
617 unit listed in
618 <varname>OnFailure=</varname> will be
619 enqueued in isolation mode, i.e. all
620 units that are not its dependency will
621 be stopped. If this is set only a
622 single unit may be listed in
623 <varname>OnFailure=</varname>. Defaults
624 to
625 <option>false</option>.</para></listitem>
626 </varlistentry>
627
c8f4d764
LP
628 <varlistentry>
629 <term><varname>IgnoreOnIsolate=</varname></term>
630
631 <listitem><para>Takes a boolean
632 argument. If <option>true</option>
633 this unit will not be stopped when
634 isolating another unit. Defaults to
635 <option>false</option>.</para></listitem>
636 </varlistentry>
637
7a6000a6
LP
638 <varlistentry>
639 <term><varname>IgnoreOnSnapshot=</varname></term>
640
641 <listitem><para>Takes a boolean
642 argument. If <option>true</option>
643 this unit will not be included in
644 snapshots. Defaults to
4e7f8bc8
ZJS
645 <option>true</option> for device and
646 snapshot units, <option>false</option>
7a6000a6
LP
647 for the others.</para></listitem>
648 </varlistentry>
649
11e29955
LP
650 <varlistentry>
651 <term><varname>StopWhenUnneeded=</varname></term>
652
653 <listitem><para>Takes a boolean
654 argument. If <option>true</option>
655 this unit will be stopped when it is
656 no longer used. Note that in order to
58c16a1a
657 minimize the work to be executed,
658 systemd will not stop units by default
11e29955
LP
659 unless they are conflicting with other
660 units, or the user explicitly
661 requested their shut down. If this
58c16a1a 662 option is set, a unit will be
11e29955
LP
663 automatically cleaned up if no other
664 active unit requires it. Defaults to
665 <option>false</option>.</para></listitem>
666 </varlistentry>
667
668 <varlistentry>
b5e9dba8
LP
669 <term><varname>RefuseManualStart=</varname></term>
670 <term><varname>RefuseManualStop=</varname></term>
11e29955
LP
671
672 <listitem><para>Takes a boolean
673 argument. If <option>true</option>
58c16a1a 674 this unit can only be activated
16dad32e 675 or deactivated indirectly. In
b5e9dba8 676 this case explicit start-up
16dad32e 677 or termination requested by the
b5e9dba8 678 user is denied, however if it is
16dad32e 679 started or stopped as a
58c16a1a 680 dependency of another unit, start-up
16dad32e 681 or termination will succeed. This
b5e9dba8
LP
682 is mostly a safety feature to ensure
683 that the user does not accidentally
684 activate units that are not intended
685 to be activated explicitly, and not
686 accidentally deactivate units that are
687 not intended to be deactivated.
688 These options default to
11e29955
LP
689 <option>false</option>.</para></listitem>
690 </varlistentry>
691
2528a7a6
LP
692 <varlistentry>
693 <term><varname>AllowIsolate=</varname></term>
694
695 <listitem><para>Takes a boolean
696 argument. If <option>true</option>
697 this unit may be used with the
698 <command>systemctl isolate</command>
699 command. Otherwise this will be
700 refused. It probably is a good idea to
701 leave this disabled except for target
702 units that shall be used similar to
703 runlevels in SysV init systems, just
704 as a precaution to avoid unusable
705 system states. This option defaults to
706 <option>false</option>.</para></listitem>
707 </varlistentry>
708
62adf224
LP
709 <varlistentry>
710 <term><varname>DefaultDependencies=</varname></term>
711
712 <listitem><para>Takes a boolean
713 argument. If <option>true</option>
714 (the default), a few default
715 dependencies will implicitly be
716 created for the unit. The actual
717 dependencies created depend on the
718 unit type. For example, for service
719 units, these dependencies ensure that
720 the service is started only after
721 basic system initialization is
58c16a1a 722 completed and is properly terminated on
62adf224
LP
723 system shutdown. See the respective
724 man pages for details. Generally, only
725 services involved with early boot or
726 late shutdown should set this option
727 to <option>false</option>. It is
728 highly recommended to leave this
729 option enabled for the majority of
730 common units. If set to
731 <option>false</option> this option
732 does not disable all implicit
733 dependencies, just non-essential
734 ones.</para></listitem>
735 </varlistentry>
736
b9975629
LP
737 <varlistentry>
738 <term><varname>JobTimeoutSec=</varname></term>
739
740 <listitem><para>When clients are
741 waiting for a job of this unit to
742 complete, time out after the specified
743 time. If this time limit is reached
744 the job will be cancelled, the unit
745 however will not change state or even
74ac3cbd
MM
746 enter the '<literal>failed</literal>'
747 mode. This value defaults to 0 (job
748 timeouts disabled), except for device
749 units. NB: this timeout is independent
750 from any unit-specific timeout (for
751 example, the timeout set with
b9975629 752 <varname>Timeout=</varname> in service
74ac3cbd
MM
753 units) as the job timeout has no
754 effect on the unit itself, only on the
755 job that might be pending for it. Or
756 in other words: unit-specific timeouts
b9975629
LP
757 are useful to abort unit state
758 changes, and revert them. The job
759 timeout set with this option however
74ac3cbd
MM
760 is useful to abort only the job
761 waiting for the unit state to
762 change.</para></listitem>
b9975629
LP
763 </varlistentry>
764
52661efd
LP
765 <varlistentry>
766 <term><varname>ConditionPathExists=</varname></term>
8092a428 767 <term><varname>ConditionPathExistsGlob=</varname></term>
c61e77d3 768 <term><varname>ConditionPathIsDirectory=</varname></term>
0d60602c 769 <term><varname>ConditionPathIsSymbolicLink=</varname></term>
ab7f148f 770 <term><varname>ConditionPathIsMountPoint=</varname></term>
d0516109 771 <term><varname>ConditionPathIsReadWrite=</varname></term>
36af55d9 772 <term><varname>ConditionDirectoryNotEmpty=</varname></term>
742a862b 773 <term><varname>ConditionFileNotEmpty=</varname></term>
82e487c5 774 <term><varname>ConditionFileIsExecutable=</varname></term>
52661efd 775 <term><varname>ConditionKernelCommandLine=</varname></term>
039655a4 776 <term><varname>ConditionVirtualization=</varname></term>
69528c31 777 <term><varname>ConditionSecurity=</varname></term>
62590f23 778 <term><varname>ConditionCapability=</varname></term>
c0d6e764 779 <term><varname>ConditionHost=</varname></term>
d257ddef 780 <term><varname>ConditionNull=</varname></term>
52661efd
LP
781
782 <listitem><para>Before starting a unit
783 verify that the specified condition is
c0d6e764
LP
784 true. If it is not true the starting
785 of the unit will be skipped, however
786 all ordering dependencies of it are
787 still respected. A failing condition
788 will not result in the unit being
789 moved into a failure state. The
790 condition is checked at the time the
791 queued start job is to be
792 executed.</para>
793
794 <para>With
52661efd 795 <varname>ConditionPathExists=</varname>
c0d6e764 796 a file existence condition is
52661efd
LP
797 checked before a unit is started. If
798 the specified absolute path name does
c0d6e764
LP
799 not exist the condition will
800 fail. If the absolute path name passed
801 to
52661efd
LP
802 <varname>ConditionPathExists=</varname>
803 is prefixed with an exclamation mark
c0d6e764 804 ('!'), the test is negated, and the unit
418112a2 805 is only started if the path does not
c0d6e764
LP
806 exist.</para>
807
808 <para><varname>ConditionPathExistsGlob=</varname>
809 is similar to
810 <varname>ConditionPathExists=</varname>,
811 but checks for the existence of at
812 least one file or directory matching
813 the specified globbing pattern.</para>
814
815 <para><varname>ConditionPathIsDirectory=</varname>
ab7f148f
LP
816 is similar to
817 <varname>ConditionPathExists=</varname>
818 but verifies whether a certain path
8571962c 819 exists and is a
c0d6e764
LP
820 directory.</para>
821
822 <para><varname>ConditionPathIsSymbolicLink=</varname>
0d60602c
MS
823 is similar to
824 <varname>ConditionPathExists=</varname>
825 but verifies whether a certain path
8095200d 826 exists and is a symbolic
c0d6e764
LP
827 link.</para>
828
829 <para><varname>ConditionPathIsMountPoint=</varname>
ab7f148f
LP
830 is similar to
831 <varname>ConditionPathExists=</varname>
832 but verifies whether a certain path
833 exists and is a mount
c0d6e764
LP
834 point.</para>
835
836 <para><varname>ConditionPathIsReadWrite=</varname>
d0516109
LP
837 is similar to
838 <varname>ConditionPathExists=</varname>
839 but verifies whether the underlying
c0d6e764 840 file system is readable and writable
d0516109 841 (i.e. not mounted
c0d6e764
LP
842 read-only).</para>
843
742a862b 844 <para><varname>ConditionDirectoryNotEmpty=</varname>
ab7f148f
LP
845 is similar to
846 <varname>ConditionPathExists=</varname>
847 but verifies whether a certain path
742a862b
LP
848 exists and is a non-empty
849 directory.</para>
c0d6e764 850
742a862b 851 <para><varname>ConditionFileNotEmpty=</varname>
c61e77d3
LP
852 is similar to
853 <varname>ConditionPathExists=</varname>
854 but verifies whether a certain path
742a862b
LP
855 exists and refers to a regular file
856 with a non-zero size.</para>
857
858 <para><varname>ConditionFileIsExecutable=</varname>
859 is similar to
860 <varname>ConditionPathExists=</varname>
861 but verifies whether a certain path
862 exists, is a regular file and marked
863 executable.</para>
c0d6e764 864
742a862b 865 <para>Similar,
52661efd
LP
866 <varname>ConditionKernelCommandLine=</varname>
867 may be used to check whether a
868 specific kernel command line option is
869 set (or if prefixed with the
870 exclamation mark unset). The argument
871 must either be a single word, or an
5471472d 872 assignment (i.e. two words, separated
c0d6e764 873 '='). In the former
d257ddef
LP
874 case the kernel command line is
875 searched for the word appearing as is,
876 or as left hand side of an
877 assignment. In the latter case the
878 exact assignment is looked for with
879 right and left hand side
c0d6e764
LP
880 matching.</para>
881
882 <para><varname>ConditionVirtualization=</varname>
039655a4
LP
883 may be used to check whether the
884 system is executed in a virtualized
885 environment and optionally test
886 whether it is a specific
887 implementation. Takes either boolean
267632f0 888 value to check if being executed in
8095200d
LP
889 any virtualized environment, or one of
890 <varname>vm</varname> and
62590f23 891 <varname>container</varname> to test
c0d6e764 892 against a generic type of
62590f23 893 virtualization solution, or one of
039655a4
LP
894 <varname>qemu</varname>,
895 <varname>kvm</varname>,
896 <varname>vmware</varname>,
897 <varname>microsoft</varname>,
898 <varname>oracle</varname>,
899 <varname>xen</varname>,
8095200d
LP
900 <varname>bochs</varname>,
901 <varname>chroot</varname>,
65bc2c21
LP
902 <varname>openvz</varname>,
903 <varname>lxc</varname>,
7d39db92 904 <varname>lxc-libvirt</varname>,
d0516109
LP
905 <varname>systemd-nspawn</varname> to
906 test against a specific
907 implementation. If multiple
908 virtualization technologies are nested
909 only the innermost is considered. The
910 test may be negated by prepending an
c0d6e764
LP
911 exclamation mark.</para>
912
913 <para><varname>ConditionSecurity=</varname>
8092a428
LP
914 may be used to check whether the given
915 security module is enabled on the
916 system. Currently the only recognized
917 value is <varname>selinux</varname>.
918 The test may be negated by prepending
62590f23 919 an exclamation
c0d6e764
LP
920 mark.</para>
921
922 <para><varname>ConditionCapability=</varname>
62590f23
LP
923 may be used to check whether the given
924 capability exists in the capability
925 bounding set of the service manager
926 (i.e. this does not check whether
927 capability is actually available in
928 the permitted or effective sets, see
929 <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
930 for details). Pass a capability name
931 such as <literal>CAP_MKNOD</literal>,
932 possibly prefixed with an exclamation
c0d6e764
LP
933 mark to negate the check.</para>
934
935 <para><varname>ConditionHost=</varname>
936 may be used to match against the
937 host name or machine ID of the
938 host. This either takes a host name
939 string (optionally with shell style
940 globs) which is tested against the
941 locally set host name as returned by
942 <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
943 or a machine ID formatted as string
944 (see
945 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
946 The test may be negated by prepending
947 an exclamation mark.</para>
948
949 <para>Finally,
d257ddef
LP
950 <varname>ConditionNull=</varname> may
951 be used to add a constant condition
952 check value to the unit. It takes a
953 boolean argument. If set to
954 <varname>false</varname> the condition
955 will always fail, otherwise
c0d6e764
LP
956 succeed.</para>
957
958 <para>If multiple conditions are
039655a4 959 specified the unit will be executed if
267632f0
LP
960 all of them apply (i.e. a logical AND
961 is applied). Condition checks can be
962 prefixed with a pipe symbol (|) in
963 which case a condition becomes a
964 triggering condition. If at least one
965 triggering condition is defined for a
966 unit then the unit will be executed if
967 at least one of the triggering
968 conditions apply and all of the
969 non-triggering conditions. If you
970 prefix an argument with the pipe
971 symbol and an exclamation mark the
972 pipe symbol must be passed first, the
0d60602c
MS
973 exclamation second. Except for
974 <varname>ConditionPathIsSymbolicLink=</varname>,
65bc2c21
LP
975 all path checks follow
976 symlinks.</para></listitem>
52661efd 977 </varlistentry>
e2130f18 978
1b64d026
LP
979 <varlistentry>
980 <term><varname>SourcePath=</varname></term>
981 <listitem><para>A path to a
982 configuration file this unit has been
983 generated from. This is primarily
984 useful for implementation of generator
985 tools that convert configuration from
986 an external configuration file format
987 into native unit files. Thus
988 functionality should not be used in
989 normal units.</para></listitem>
990 </varlistentry>
d1ab0ca0 991 </variablelist>
771610b0
LP
992
993 <para>Unit file may include a [Install] section, which
994 carries installation information for the unit. This
995 section is not interpreted by
996 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
997 during runtime. It is used exclusively by the
ee5762e3
LP
998 <command>enable</command> and
999 <command>disable</command> commands of the
1000 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
11e29955 1001 tool during installation of a unit:</para>
771610b0
LP
1002
1003 <variablelist>
1004 <varlistentry>
1005 <term><varname>Alias=</varname></term>
1006
0a715d97 1007 <listitem><para>Additional names this
771610b0
LP
1008 unit shall be installed under. The
1009 names listed here must have the same
1010 suffix (i.e. type) as the unit file
1011 name. This option may be specified
1012 more than once, in which case all
1013 listed names are used. At installation
af62c704 1014 time,
ee5762e3 1015 <command>systemctl enable</command>
771610b0 1016 will create symlinks from these names
8ff290af 1017 to the unit file name.</para></listitem>
11e29955
LP
1018 </varlistentry>
1019
1020 <varlistentry>
1021 <term><varname>WantedBy=</varname></term>
78d54bd4 1022 <term><varname>RequiredBy=</varname></term>
11e29955
LP
1023
1024 <listitem><para>Installs a symlink in
1025 the <filename>.wants/</filename>
16dad32e
AE
1026 or <filename>.requires/</filename>
1027 subdirectory for a unit, respectively. This has the
11e29955
LP
1028 effect that when the listed unit name
1029 is activated the unit listing it is
1030 activated
6cbdbc5f 1031 too. <command>WantedBy=foo.service</command>
11e29955
LP
1032 in a service
1033 <filename>bar.service</filename> is
1034 mostly equivalent to
1035 <command>Alias=foo.service.wants/bar.service</command>
1036 in the same file.</para></listitem>
1037 </varlistentry>
1038
1039 <varlistentry>
1040 <term><varname>Also=</varname></term>
1041
1042 <listitem><para>Additional units to
1043 install when this unit is
1044 installed. If the user requests
1045 installation of a unit with this
58c16a1a 1046 option configured,
ee5762e3 1047 <command>systemctl enable</command>
11e29955
LP
1048 will automatically install units
1049 listed in this option as
1050 well.</para></listitem>
771610b0
LP
1051 </varlistentry>
1052 </variablelist>
1053
d1ab0ca0
LP
1054 </refsect1>
1055
1056 <refsect1>
160cd5c9
LP
1057 <title>See Also</title>
1058 <para>
1059 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
771610b0 1060 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
771610b0
LP
1061 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1062 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1063 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1064 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1065 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1066 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1067 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1068 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1069 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
5f2ee303 1070 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
62590f23
LP
1071 <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1072 <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
160cd5c9 1073 </para>
d1ab0ca0
LP
1074 </refsect1>
1075
1076</refentry>