]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.unit.xml
unit: add ConditionACPower=
[thirdparty/systemd.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
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
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
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
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
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>
47 <refpurpose>Unit configuration</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
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>,
59 <filename>systemd.timer</filename>,
60 <filename>systemd.snapshot</filename></para>
61 </refsynopsisdiv>
62
63 <refsect1>
64 <title>Description</title>
65
66 <para>A unit configuration file encodes information
67 about a service, a socket, a device, a mount point, an
68 automount point, a swap file or partition, a start-up
69 target, a file system path or a timer controlled and
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
74 Desktop Entry Specification</ulink> <filename>.desktop</filename> files, which are in turn
75 inspired by Microsoft Windows
76 <filename>.ini</filename> files.</para>
77
78 <para>This man page lists the common configuration
79 options of all the unit types. These options need to
80 be configured in the [Unit] or [Install]
81 sections of the unit files.</para>
82
83 <para>In addition to the generic [Unit] and [Install]
84 sections described here, each unit should have a
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
98 written in various formats. For positive settings the
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
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
109 unit, the unit is honored. A concatenation of
110 multiple values with units is supported, in which case
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. For details see <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
115
116 <para>Empty lines and lines starting with # or ; are
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>
121
122 <para>If a line starts with <option>.include</option>
123 followed by a file name, the specified file will be
124 parsed at this point. Make sure that the file that is
125 included has the appropriate section headers before
126 any directives.</para>
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
140 with the <command>enable</command> command of the
141 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
142 tool which reads information from the [Install]
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>
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>
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
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>
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
184 it is found.</para>
185
186 <para>To refer to the instance string from
187 within the configuration file you may use the special
188 <literal>%i</literal> specifier in many of the
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>
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>%U</literal></entry>
268 <entry>User uid</entry>
269 <entry>This is the uid of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
270 </row>
271 <row>
272 <entry><literal>%h</literal></entry>
273 <entry>User home directory</entry>
274 <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>
275 </row>
276 <row>
277 <entry><literal>%s</literal></entry>
278 <entry>User shell</entry>
279 <entry>This is the shell of the configured user of the unit, or (if none is set) the user running the systemd instance.</entry>
280 </row>
281 <row>
282 <entry><literal>%m</literal></entry>
283 <entry>Machine ID</entry>
284 <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>
285 </row>
286 <row>
287 <entry><literal>%b</literal></entry>
288 <entry>Boot ID</entry>
289 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
290 </row>
291 <row>
292 <entry><literal>%H</literal></entry>
293 <entry>Host name</entry>
294 <entry>The host name of the running system.</entry>
295 </row>
296 </tbody>
297 </tgroup>
298 </table>
299
300 <para>If a unit file is empty (i.e. has the file size
301 0) or is symlinked to <filename>/dev/null</filename>
302 its configuration will not be loaded and it appears
303 with a load state of <literal>masked</literal>, and
304 cannot be activated. Use this as an effective way to
305 fully disable a unit, making it impossible to start it
306 even manually.</para>
307
308 <para>The unit file format is covered by the
309 <ulink
310 url="http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface
311 Stability Promise</ulink>.</para>
312 </refsect1>
313
314 <refsect1>
315 <title>Options</title>
316
317 <para>Unit file may include a [Unit] section, which
318 carries generic information about the unit that is not
319 dependent on the type of unit:</para>
320
321 <variablelist>
322
323 <varlistentry>
324 <term><varname>Description=</varname></term>
325 <listitem><para>A free-form string
326 describing the unit. This is intended
327 for use in UIs to show descriptive
328 information along with the unit
329 name.</para></listitem>
330 </varlistentry>
331
332 <varlistentry>
333 <term><varname>Documentation=</varname></term>
334 <listitem><para>A space separated list
335 of URIs referencing documentation for
336 this unit or its
337 configuration. Accepted are only URIs
338 of the types
339 <literal>http://</literal>,
340 <literal>https://</literal>,
341 <literal>file:</literal>,
342 <literal>info:</literal>,
343 <literal>man:</literal>. For more
344 information about the syntax of these
345 URIs see
346 <citerefentry><refentrytitle>uri</refentrytitle><manvolnum>7</manvolnum></citerefentry>. The
347 URIs should be listed in order of
348 relevance, starting with the most
349 relevant. It is a good idea to first
350 reference documentation that explains
351 what the unit's purpose is, followed
352 by how it is configured, followed by
353 any other related
354 documentation.</para></listitem>
355 </varlistentry>
356
357 <varlistentry>
358 <term><varname>Requires=</varname></term>
359
360 <listitem><para>Configures requirement
361 dependencies on other units. If this
362 unit gets activated, the units listed
363 here will be activated as well. If one
364 of the other units gets deactivated or
365 its activation fails, this unit will
366 be deactivated. This option may be
367 specified more than once, in which
368 case requirement dependencies for all
369 listed names are created. Note that
370 requirement dependencies do not
371 influence the order in which services
372 are started or stopped. This has to be
373 configured independently with the
374 <varname>After=</varname> or
375 <varname>Before=</varname> options. If
376 a unit
377 <filename>foo.service</filename>
378 requires a unit
379 <filename>bar.service</filename> as
380 configured with
381 <varname>Requires=</varname> and no
382 ordering is configured with
383 <varname>After=</varname> or
384 <varname>Before=</varname>, then both
385 units will be started simultaneously
386 and without any delay between them if
387 <filename>foo.service</filename> is
388 activated. Often it is a better choice
389 to use <varname>Wants=</varname>
390 instead of
391 <varname>Requires=</varname> in order
392 to achieve a system that is more
393 robust when dealing with failing
394 services.</para>
395
396 <para>Note that dependencies of this
397 type may also be configured outside of
398 the unit configuration file by
399 adding a symlink to a
400 <filename>.requires/</filename> directory
401 accompanying the unit file. For
402 details see above.</para></listitem>
403 </varlistentry>
404
405 <varlistentry>
406 <term><varname>RequiresOverridable=</varname></term>
407
408 <listitem><para>Similar to
409 <varname>Requires=</varname>.
410 Dependencies listed in
411 <varname>RequiresOverridable=</varname>
412 which cannot be fulfilled or fail to
413 start are ignored if the startup was
414 explicitly requested by the user. If
415 the start-up was pulled in indirectly
416 by some dependency or automatic
417 start-up of units that is not
418 requested by the user this dependency
419 must be fulfilled and otherwise the
420 transaction fails. Hence, this option
421 may be used to configure dependencies
422 that are normally honored unless the
423 user explicitly starts up the unit, in
424 which case whether they failed or not
425 is irrelevant.</para></listitem>
426
427 </varlistentry>
428 <varlistentry>
429 <term><varname>Requisite=</varname></term>
430 <term><varname>RequisiteOverridable=</varname></term>
431
432 <listitem><para>Similar to
433 <varname>Requires=</varname>
434 and <varname>RequiresOverridable=</varname>, respectively. However,
435 if a unit listed here is not started
436 already it will not be started and the
437 transaction fails
438 immediately.</para></listitem>
439 </varlistentry>
440
441 <varlistentry>
442 <term><varname>Wants=</varname></term>
443
444 <listitem><para>A weaker version of
445 <varname>Requires=</varname>. A unit
446 listed in this option will be started
447 if the configuring unit is. However,
448 if the listed unit fails to start up
449 or cannot be added to the transaction
450 this has no impact on the validity of
451 the transaction as a whole. This is
452 the recommended way to hook start-up
453 of one unit to the start-up of another
454 unit.</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>.wants/</filename> directory
461 accompanying the unit file. For
462 details see above.</para></listitem>
463 </varlistentry>
464
465 <varlistentry>
466 <term><varname>BindsTo=</varname></term>
467
468 <listitem><para>Configures requirement
469 dependencies, very similar in style to
470 <varname>Requires=</varname>, however
471 in addition to this behavior it also
472 declares that this unit is stopped
473 when any of the units listed suddenly
474 disappears. Units can suddenly,
475 unexpectedly disappear if a service
476 terminates on its own choice, a device
477 is unplugged or a mount point
478 unmounted without involvement of
479 systemd.</para></listitem>
480 </varlistentry>
481
482 <varlistentry>
483 <term><varname>PartOf=</varname></term>
484
485 <listitem><para>Configures dependencies
486 similar to <varname>Requires=</varname>,
487 but limited to stopping and restarting
488 of units. When systemd stops or restarts
489 the units listed here, the action is
490 propagated to this unit.
491 Note that this is a one way dependency -
492 changes to this unit do not affect the
493 listed units.
494 </para></listitem>
495 </varlistentry>
496
497 <varlistentry>
498 <term><varname>Conflicts=</varname></term>
499
500 <listitem><para>Configures negative
501 requirement dependencies. If a unit
502 has a
503 <varname>Conflicts=</varname> setting
504 on another unit, starting the former
505 will stop the latter and vice
506 versa. Note that this setting is
507 independent of and orthogonal to the
508 <varname>After=</varname> and
509 <varname>Before=</varname> ordering
510 dependencies.</para>
511
512 <para>If a unit A that conflicts with
513 a unit B is scheduled to be started at
514 the same time as B, the transaction
515 will either fail (in case both are
516 required part of the transaction) or
517 be modified to be fixed (in case one
518 or both jobs are not a required part
519 of the transaction). In the latter
520 case the job that is not the required
521 will be removed, or in case both are
522 not required the unit that conflicts
523 will be started and the unit that is
524 conflicted is
525 stopped.</para></listitem>
526 </varlistentry>
527
528 <varlistentry>
529 <term><varname>Before=</varname></term>
530 <term><varname>After=</varname></term>
531
532 <listitem><para>Configures ordering
533 dependencies between units. If a unit
534 <filename>foo.service</filename>
535 contains a setting
536 <option>Before=bar.service</option>
537 and both units are being started,
538 <filename>bar.service</filename>'s
539 start-up is delayed until
540 <filename>foo.service</filename> is
541 started up. Note that this setting is
542 independent of and orthogonal to the
543 requirement dependencies as configured
544 by <varname>Requires=</varname>. It is
545 a common pattern to include a unit
546 name in both the
547 <varname>After=</varname> and
548 <varname>Requires=</varname> option in
549 which case the unit listed will be
550 started before the unit that is
551 configured with these options. This
552 option may be specified more than
553 once, in which case ordering
554 dependencies for all listed names are
555 created. <varname>After=</varname> is
556 the inverse of
557 <varname>Before=</varname>, i.e. while
558 <varname>After=</varname> ensures that
559 the configured unit is started after
560 the listed unit finished starting up,
561 <varname>Before=</varname> ensures the
562 opposite, i.e. that the configured
563 unit is fully started up before the
564 listed unit is started. Note that when
565 two units with an ordering dependency
566 between them are shut down, the
567 inverse of the start-up order is
568 applied. i.e. if a unit is configured
569 with <varname>After=</varname> on
570 another unit, the former is stopped
571 before the latter if both are shut
572 down. If one unit with an ordering
573 dependency on another unit is shut
574 down while the latter is started up,
575 the shut down is ordered before the
576 start-up regardless whether the
577 ordering dependency is actually of
578 type <varname>After=</varname> or
579 <varname>Before=</varname>. If two
580 units have no ordering dependencies
581 between them they are shut down
582 or started up simultaneously, and
583 no ordering takes
584 place. </para></listitem>
585 </varlistentry>
586
587 <varlistentry>
588 <term><varname>OnFailure=</varname></term>
589
590 <listitem><para>Lists one or more
591 units that are activated when this
592 unit enters the
593 '<literal>failed</literal>'
594 state.</para></listitem>
595 </varlistentry>
596
597 <varlistentry>
598 <term><varname>PropagatesReloadTo=</varname></term>
599 <term><varname>ReloadPropagatedFrom=</varname></term>
600
601 <listitem><para>Lists one or more
602 units where reload requests on the
603 unit will be propagated to/on the
604 other unit will be propagated
605 from. Issuing a reload request on a
606 unit will automatically also enqueue a
607 reload request on all units that the
608 reload request shall be propagated to
609 via these two
610 settings.</para></listitem>
611 </varlistentry>
612
613 <varlistentry>
614 <term><varname>RequiresMountsFor=</varname></term>
615
616 <listitem><para>Takes a space
617 separated list of absolute paths. Automatically
618 adds dependencies of type
619 <varname>Requires=</varname> and
620 <varname>After=</varname> for all
621 mount units required to access the
622 specified path.</para></listitem>
623 </varlistentry>
624
625 <varlistentry>
626 <term><varname>OnFailureIsolate=</varname></term>
627
628 <listitem><para>Takes a boolean
629 argument. If <option>true</option> the
630 unit listed in
631 <varname>OnFailure=</varname> will be
632 enqueued in isolation mode, i.e. all
633 units that are not its dependency will
634 be stopped. If this is set only a
635 single unit may be listed in
636 <varname>OnFailure=</varname>. Defaults
637 to
638 <option>false</option>.</para></listitem>
639 </varlistentry>
640
641 <varlistentry>
642 <term><varname>IgnoreOnIsolate=</varname></term>
643
644 <listitem><para>Takes a boolean
645 argument. If <option>true</option>
646 this unit will not be stopped when
647 isolating another unit. Defaults to
648 <option>false</option>.</para></listitem>
649 </varlistentry>
650
651 <varlistentry>
652 <term><varname>IgnoreOnSnapshot=</varname></term>
653
654 <listitem><para>Takes a boolean
655 argument. If <option>true</option>
656 this unit will not be included in
657 snapshots. Defaults to
658 <option>true</option> for device and
659 snapshot units, <option>false</option>
660 for the others.</para></listitem>
661 </varlistentry>
662
663 <varlistentry>
664 <term><varname>StopWhenUnneeded=</varname></term>
665
666 <listitem><para>Takes a boolean
667 argument. If <option>true</option>
668 this unit will be stopped when it is
669 no longer used. Note that in order to
670 minimize the work to be executed,
671 systemd will not stop units by default
672 unless they are conflicting with other
673 units, or the user explicitly
674 requested their shut down. If this
675 option is set, a unit will be
676 automatically cleaned up if no other
677 active unit requires it. Defaults to
678 <option>false</option>.</para></listitem>
679 </varlistentry>
680
681 <varlistentry>
682 <term><varname>RefuseManualStart=</varname></term>
683 <term><varname>RefuseManualStop=</varname></term>
684
685 <listitem><para>Takes a boolean
686 argument. If <option>true</option>
687 this unit can only be activated
688 or deactivated indirectly. In
689 this case explicit start-up
690 or termination requested by the
691 user is denied, however if it is
692 started or stopped as a
693 dependency of another unit, start-up
694 or termination will succeed. This
695 is mostly a safety feature to ensure
696 that the user does not accidentally
697 activate units that are not intended
698 to be activated explicitly, and not
699 accidentally deactivate units that are
700 not intended to be deactivated.
701 These options default to
702 <option>false</option>.</para></listitem>
703 </varlistentry>
704
705 <varlistentry>
706 <term><varname>AllowIsolate=</varname></term>
707
708 <listitem><para>Takes a boolean
709 argument. If <option>true</option>
710 this unit may be used with the
711 <command>systemctl isolate</command>
712 command. Otherwise this will be
713 refused. It probably is a good idea to
714 leave this disabled except for target
715 units that shall be used similar to
716 runlevels in SysV init systems, just
717 as a precaution to avoid unusable
718 system states. This option defaults to
719 <option>false</option>.</para></listitem>
720 </varlistentry>
721
722 <varlistentry>
723 <term><varname>DefaultDependencies=</varname></term>
724
725 <listitem><para>Takes a boolean
726 argument. If <option>true</option>
727 (the default), a few default
728 dependencies will implicitly be
729 created for the unit. The actual
730 dependencies created depend on the
731 unit type. For example, for service
732 units, these dependencies ensure that
733 the service is started only after
734 basic system initialization is
735 completed and is properly terminated on
736 system shutdown. See the respective
737 man pages for details. Generally, only
738 services involved with early boot or
739 late shutdown should set this option
740 to <option>false</option>. It is
741 highly recommended to leave this
742 option enabled for the majority of
743 common units. If set to
744 <option>false</option> this option
745 does not disable all implicit
746 dependencies, just non-essential
747 ones.</para></listitem>
748 </varlistentry>
749
750 <varlistentry>
751 <term><varname>JobTimeoutSec=</varname></term>
752
753 <listitem><para>When clients are
754 waiting for a job of this unit to
755 complete, time out after the specified
756 time. If this time limit is reached
757 the job will be cancelled, the unit
758 however will not change state or even
759 enter the '<literal>failed</literal>'
760 mode. This value defaults to 0 (job
761 timeouts disabled), except for device
762 units. NB: this timeout is independent
763 from any unit-specific timeout (for
764 example, the timeout set with
765 <varname>Timeout=</varname> in service
766 units) as the job timeout has no
767 effect on the unit itself, only on the
768 job that might be pending for it. Or
769 in other words: unit-specific timeouts
770 are useful to abort unit state
771 changes, and revert them. The job
772 timeout set with this option however
773 is useful to abort only the job
774 waiting for the unit state to
775 change.</para></listitem>
776 </varlistentry>
777
778 <varlistentry>
779 <term><varname>ConditionPathExists=</varname></term>
780 <term><varname>ConditionPathExistsGlob=</varname></term>
781 <term><varname>ConditionPathIsDirectory=</varname></term>
782 <term><varname>ConditionPathIsSymbolicLink=</varname></term>
783 <term><varname>ConditionPathIsMountPoint=</varname></term>
784 <term><varname>ConditionPathIsReadWrite=</varname></term>
785 <term><varname>ConditionDirectoryNotEmpty=</varname></term>
786 <term><varname>ConditionFileNotEmpty=</varname></term>
787 <term><varname>ConditionFileIsExecutable=</varname></term>
788 <term><varname>ConditionKernelCommandLine=</varname></term>
789 <term><varname>ConditionVirtualization=</varname></term>
790 <term><varname>ConditionSecurity=</varname></term>
791 <term><varname>ConditionCapability=</varname></term>
792 <term><varname>ConditionHost=</varname></term>
793 <term><varname>ConditionACPower=</varname></term>
794 <term><varname>ConditionNull=</varname></term>
795
796 <listitem><para>Before starting a unit
797 verify that the specified condition is
798 true. If it is not true the starting
799 of the unit will be skipped, however
800 all ordering dependencies of it are
801 still respected. A failing condition
802 will not result in the unit being
803 moved into a failure state. The
804 condition is checked at the time the
805 queued start job is to be
806 executed.</para>
807
808 <para>With
809 <varname>ConditionPathExists=</varname>
810 a file existence condition is
811 checked before a unit is started. If
812 the specified absolute path name does
813 not exist the condition will
814 fail. If the absolute path name passed
815 to
816 <varname>ConditionPathExists=</varname>
817 is prefixed with an exclamation mark
818 ('!'), the test is negated, and the unit
819 is only started if the path does not
820 exist.</para>
821
822 <para><varname>ConditionPathExistsGlob=</varname>
823 is similar to
824 <varname>ConditionPathExists=</varname>,
825 but checks for the existence of at
826 least one file or directory matching
827 the specified globbing pattern.</para>
828
829 <para><varname>ConditionPathIsDirectory=</varname>
830 is similar to
831 <varname>ConditionPathExists=</varname>
832 but verifies whether a certain path
833 exists and is a
834 directory.</para>
835
836 <para><varname>ConditionPathIsSymbolicLink=</varname>
837 is similar to
838 <varname>ConditionPathExists=</varname>
839 but verifies whether a certain path
840 exists and is a symbolic
841 link.</para>
842
843 <para><varname>ConditionPathIsMountPoint=</varname>
844 is similar to
845 <varname>ConditionPathExists=</varname>
846 but verifies whether a certain path
847 exists and is a mount
848 point.</para>
849
850 <para><varname>ConditionPathIsReadWrite=</varname>
851 is similar to
852 <varname>ConditionPathExists=</varname>
853 but verifies whether the underlying
854 file system is readable and writable
855 (i.e. not mounted
856 read-only).</para>
857
858 <para><varname>ConditionDirectoryNotEmpty=</varname>
859 is similar to
860 <varname>ConditionPathExists=</varname>
861 but verifies whether a certain path
862 exists and is a non-empty
863 directory.</para>
864
865 <para><varname>ConditionFileNotEmpty=</varname>
866 is similar to
867 <varname>ConditionPathExists=</varname>
868 but verifies whether a certain path
869 exists and refers to a regular file
870 with a non-zero size.</para>
871
872 <para><varname>ConditionFileIsExecutable=</varname>
873 is similar to
874 <varname>ConditionPathExists=</varname>
875 but verifies whether a certain path
876 exists, is a regular file and marked
877 executable.</para>
878
879 <para>Similar,
880 <varname>ConditionKernelCommandLine=</varname>
881 may be used to check whether a
882 specific kernel command line option is
883 set (or if prefixed with the
884 exclamation mark unset). The argument
885 must either be a single word, or an
886 assignment (i.e. two words, separated
887 '='). In the former
888 case the kernel command line is
889 searched for the word appearing as is,
890 or as left hand side of an
891 assignment. In the latter case the
892 exact assignment is looked for with
893 right and left hand side
894 matching.</para>
895
896 <para><varname>ConditionVirtualization=</varname>
897 may be used to check whether the
898 system is executed in a virtualized
899 environment and optionally test
900 whether it is a specific
901 implementation. Takes either boolean
902 value to check if being executed in
903 any virtualized environment, or one of
904 <varname>vm</varname> and
905 <varname>container</varname> to test
906 against a generic type of
907 virtualization solution, or one of
908 <varname>qemu</varname>,
909 <varname>kvm</varname>,
910 <varname>vmware</varname>,
911 <varname>microsoft</varname>,
912 <varname>oracle</varname>,
913 <varname>xen</varname>,
914 <varname>bochs</varname>,
915 <varname>chroot</varname>,
916 <varname>openvz</varname>,
917 <varname>lxc</varname>,
918 <varname>lxc-libvirt</varname>,
919 <varname>systemd-nspawn</varname> to
920 test against a specific
921 implementation. If multiple
922 virtualization technologies are nested
923 only the innermost is considered. The
924 test may be negated by prepending an
925 exclamation mark.</para>
926
927 <para><varname>ConditionSecurity=</varname>
928 may be used to check whether the given
929 security module is enabled on the
930 system. Currently the only recognized
931 value is <varname>selinux</varname>.
932 The test may be negated by prepending
933 an exclamation
934 mark.</para>
935
936 <para><varname>ConditionCapability=</varname>
937 may be used to check whether the given
938 capability exists in the capability
939 bounding set of the service manager
940 (i.e. this does not check whether
941 capability is actually available in
942 the permitted or effective sets, see
943 <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
944 for details). Pass a capability name
945 such as <literal>CAP_MKNOD</literal>,
946 possibly prefixed with an exclamation
947 mark to negate the check.</para>
948
949 <para><varname>ConditionHost=</varname>
950 may be used to match against the
951 host name or machine ID of the
952 host. This either takes a host name
953 string (optionally with shell style
954 globs) which is tested against the
955 locally set host name as returned by
956 <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
957 or a machine ID formatted as string
958 (see
959 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
960 The test may be negated by prepending
961 an exclamation mark.</para>
962
963 <para><varname>ConditionACPower=</varname>
964 may may be used to check whether the
965 system has AC power, or is exlcusively
966 battery powered at the time of
967 activation of the unit. This takes a
968 boolean argument. If set to
969 <varname>true</varname> the condition
970 will hold only if at least one AC
971 connector of the system is connected
972 to a power source, or if no AC
973 connectors are known. Conversely, if
974 set to <varname>false</varname> the
975 condition will hold only if there is
976 at least one AC connector known and
977 all AC connectors are disconnected
978 from a power source.</para>
979
980 <para>Finally,
981 <varname>ConditionNull=</varname> may
982 be used to add a constant condition
983 check value to the unit. It takes a
984 boolean argument. If set to
985 <varname>false</varname> the condition
986 will always fail, otherwise
987 succeed.</para>
988
989 <para>If multiple conditions are
990 specified the unit will be executed if
991 all of them apply (i.e. a logical AND
992 is applied). Condition checks can be
993 prefixed with a pipe symbol (|) in
994 which case a condition becomes a
995 triggering condition. If at least one
996 triggering condition is defined for a
997 unit then the unit will be executed if
998 at least one of the triggering
999 conditions apply and all of the
1000 non-triggering conditions. If you
1001 prefix an argument with the pipe
1002 symbol and an exclamation mark the
1003 pipe symbol must be passed first, the
1004 exclamation second. Except for
1005 <varname>ConditionPathIsSymbolicLink=</varname>,
1006 all path checks follow
1007 symlinks.</para></listitem>
1008 </varlistentry>
1009
1010 <varlistentry>
1011 <term><varname>SourcePath=</varname></term>
1012 <listitem><para>A path to a
1013 configuration file this unit has been
1014 generated from. This is primarily
1015 useful for implementation of generator
1016 tools that convert configuration from
1017 an external configuration file format
1018 into native unit files. Thus
1019 functionality should not be used in
1020 normal units.</para></listitem>
1021 </varlistentry>
1022 </variablelist>
1023
1024 <para>Unit file may include a [Install] section, which
1025 carries installation information for the unit. This
1026 section is not interpreted by
1027 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1028 during runtime. It is used exclusively by the
1029 <command>enable</command> and
1030 <command>disable</command> commands of the
1031 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1032 tool during installation of a unit:</para>
1033
1034 <variablelist>
1035 <varlistentry>
1036 <term><varname>Alias=</varname></term>
1037
1038 <listitem><para>Additional names this
1039 unit shall be installed under. The
1040 names listed here must have the same
1041 suffix (i.e. type) as the unit file
1042 name. This option may be specified
1043 more than once, in which case all
1044 listed names are used. At installation
1045 time,
1046 <command>systemctl enable</command>
1047 will create symlinks from these names
1048 to the unit file name.</para></listitem>
1049 </varlistentry>
1050
1051 <varlistentry>
1052 <term><varname>WantedBy=</varname></term>
1053 <term><varname>RequiredBy=</varname></term>
1054
1055 <listitem><para>Installs a symlink in
1056 the <filename>.wants/</filename>
1057 or <filename>.requires/</filename>
1058 subdirectory for a unit, respectively. This has the
1059 effect that when the listed unit name
1060 is activated the unit listing it is
1061 activated
1062 too. <command>WantedBy=foo.service</command>
1063 in a service
1064 <filename>bar.service</filename> is
1065 mostly equivalent to
1066 <command>Alias=foo.service.wants/bar.service</command>
1067 in the same file.</para></listitem>
1068 </varlistentry>
1069
1070 <varlistentry>
1071 <term><varname>Also=</varname></term>
1072
1073 <listitem><para>Additional units to
1074 install when this unit is
1075 installed. If the user requests
1076 installation of a unit with this
1077 option configured,
1078 <command>systemctl enable</command>
1079 will automatically install units
1080 listed in this option as
1081 well.</para></listitem>
1082 </varlistentry>
1083 </variablelist>
1084
1085 </refsect1>
1086
1087 <refsect1>
1088 <title>See Also</title>
1089 <para>
1090 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1091 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1092 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1093 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1094 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1095 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1096 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1097 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1098 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1099 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1100 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1101 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1102 <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1103 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1104 <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1105 </para>
1106 </refsect1>
1107
1108 </refentry>