]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.unit.xml
service: handle forking services that move to a new PID
[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
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 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 General Public License for more details.
19
20 You should have received a copy of the GNU 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>systemd unit configuration files</refpurpose>
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
11e29955 80 be configured in the [Unit] resp. [Install]
771610b0 81 section 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
124 read as if its contents were listed in place of the
11e29955
LP
125 <option>.include</option> directive.</para>
126
127 <para>Along with a unit file
128 <filename>foo.service</filename> a directory
129 <filename>foo.service.wants/</filename> may exist. All
130 units symlinked from such a directory are implicitly
131 added as dependencies of type
132 <varname>Wanted=</varname> to the unit. This is useful
133 to hook units into the start-up of other units,
134 without having to modify their unit configuration
135 files. For details about the semantics of
136 <varname>Wanted=</varname> see below. The preferred
137 way to create symlinks in the
138 <filename>.wants/</filename> directory of a service is
ee5762e3
LP
139 with the <command>enable</command> command of the
140 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
11e29955 141 tool which reads information from the [Install]
0732ec00
LP
142 section of unit files. (See below.) A similar
143 functionality exists for <varname>Requires=</varname>
144 type dependencies as well, the directory suffix is
145 <filename>.requires/</filename> in this case.</para>
11e29955
LP
146
147 <para>Note that while systemd offers a flexible
148 dependency system between units it is recommended to
149 use this functionality only sparsely and instead rely
150 on techniques such as bus-based or socket-based
151 activation which makes dependencies implicit, which
152 both results in a simpler and more flexible
153 system.</para>
1f812fea
LP
154
155 <para>Some unit names reflect paths existing in the
156 file system name space. Example: a device unit
157 <filename>dev-sda.device</filename> refers to a device
158 with the device node <filename>/dev/sda</filename> in
159 the file system namespace. If this applies a special
085b94ee
LP
160 way to escape the path name is used, so that the
161 result is usable as part of a file name. Basically,
162 given a path, "/" is replaced by "-", and all
163 unprintable characters and the "-" are replaced by
164 C-style "\x20" escapes. The root directory "/" is
165 encoded as single dash, while otherwise the initial
166 and ending "/" is removed from all paths during
167 transformation. This escaping is reversible.</para>
1f812fea
LP
168
169 <para>Optionally, units may be instantiated from a
170 template file at runtime. This allows creation of
171 multiple units from a single configuration file. If
172 systemd looks for a unit configuration file it will
173 first search for the literal unit name in the
174 filesystem. If that yields no success and the unit
175 name contains an @ character, systemd will look for a
176 unit template that shares the same name but with the
177 instance string (i.e. the part between the @ character
178 and the suffix) removed. Example: if a service
179 <filename>getty@tty3.service</filename> is requested
180 and no file by that name is found, systemd will look
181 for <filename>getty@.service</filename> and
182 instantiate a service from that configuration file if
0e89268b
MB
183 it is found.</para>
184
185 <para>To refer to the instance string from
1f812fea
LP
186 within the configuration file you may use the special
187 <literal>%i</literal> specifier in many of the
0e89268b
MB
188 configuration options. Other specifiers exist, the
189 full list is:</para>
190
191 <table>
192 <title>Specifiers available in unit files</title>
193 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
194 <colspec colname="spec" />
195 <colspec colname="mean" />
196 <colspec colname="detail" />
197 <thead>
198 <row>
199 <entry>Specifier</entry>
200 <entry>Meaning</entry>
201 <entry>Details</entry>
202 </row>
203 </thead>
204 <tbody>
205 <row>
206 <entry><literal>%n</literal></entry>
207 <entry>Full unit name</entry>
208 <entry></entry>
209 </row>
210 <row>
211 <entry><literal>%N</literal></entry>
212 <entry>Unescaped full unit name</entry>
213 <entry></entry>
214 </row>
215 <row>
216 <entry><literal>%p</literal></entry>
217 <entry>Prefix name</entry>
218 <entry>This refers to the string before the @, i.e. "getty" in the example above, where "tty3" is the instance name.</entry>
219 </row>
220 <row>
221 <entry><literal>%P</literal></entry>
222 <entry>Unescaped prefix name</entry>
223 <entry></entry>
224 </row>
225 <row>
226 <entry><literal>%i</literal></entry>
227 <entry>Instance name</entry>
228 <entry>This is the string between the @ character and the suffix.</entry>
229 </row>
230 <row>
231 <entry><literal>%I</literal></entry>
232 <entry>Unescaped instance name</entry>
233 <entry></entry>
234 </row>
235 <row>
236 <entry><literal>%f</literal></entry>
237 <entry>Unescaped file name</entry>
238 <entry>This is either the unescaped instance name (if set) with / prepended (if necessary), or the prefix name similarly prepended with /.</entry>
239 </row>
240 <row>
241 <entry><literal>%c</literal></entry>
242 <entry>Control group path of the unit</entry>
243 <entry></entry>
244 </row>
245 <row>
246 <entry><literal>%r</literal></entry>
247 <entry>Root control group path of systemd</entry>
248 <entry></entry>
249 </row>
250 <row>
251 <entry><literal>%R</literal></entry>
252 <entry>Parent directory of the root control group path of systemd</entry>
253 <entry></entry>
254 </row>
255 <row>
256 <entry><literal>%t</literal></entry>
257 <entry>Runtime socket dir</entry>
258 <entry>This is either /run (for the system manager) or $XDG_RUNTIME_DIR (for user managers).</entry>
259 </row>
260 </tbody>
261 </tgroup>
262 </table>
b9aea954 263
6daf4f90
LP
264 <para>If a unit file is empty (i.e. has the file size
265 0) or is symlinked to <filename>/dev/null</filename>
266 its configuration will not be loaded and it appears
267 with a load state of <literal>masked</literal>, and
268 cannot be activated. Use this as an effective way to
269 fully disable a unit, making it impossible to start it
270 even manually.</para>
271
b9aea954
LP
272 <para>The unit file format is covered by the
273 <ulink
274 url="http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface
275 Stability Promise</ulink>.</para>
d1ab0ca0
LP
276 </refsect1>
277
278 <refsect1>
279 <title>Options</title>
280
771610b0
LP
281 <para>Unit file may include a [Unit] section, which
282 carries generic information about the unit that is not
283 dependent on the type of unit:</para>
284
d1ab0ca0 285 <variablelist>
11e29955
LP
286
287 <varlistentry>
288 <term><varname>Description=</varname></term>
289 <listitem><para>A free-form string
62adf224
LP
290 describing the unit. This is intended
291 for use in UIs to show descriptive
292 information along with the unit
293 name.</para></listitem>
11e29955
LP
294 </varlistentry>
295
d1ab0ca0 296 <varlistentry>
9f235308 297 <term><varname>Requires=</varname></term>
771610b0 298
11e29955 299 <listitem><para>Configures requirement
771610b0 300 dependencies on other units. If this
58c16a1a 301 unit gets activated, the units listed
771610b0
LP
302 here will be activated as well. If one
303 of the other units gets deactivated or
304 its activation fails, this unit will
305 be deactivated. This option may be
306 specified more than once, in which
307 case requirement dependencies for all
11e29955
LP
308 listed names are created. Note that
309 requirement dependencies do not
310 influence the order in which services
311 are started or stopped. This has to be
312 configured independently with the
313 <varname>After=</varname> or
314 <varname>Before=</varname> options. If
315 a unit
316 <filename>foo.service</filename>
317 requires a unit
318 <filename>bar.service</filename> as
319 configured with
320 <varname>Requires=</varname> and no
321 ordering is configured with
322 <varname>After=</varname> or
323 <varname>Before=</varname>, then both
324 units will be started simultaneously
325 and without any delay between them if
326 <filename>foo.service</filename> is
327 activated. Often it is a better choice
328 to use <varname>Wants=</varname>
329 instead of
330 <varname>Requires=</varname> in order
331 to achieve a system that is more
332 robust when dealing with failing
333 services.</para></listitem>
d1ab0ca0 334 </varlistentry>
11e29955 335
11e29955
LP
336 <varlistentry>
337 <term><varname>RequiresOverridable=</varname></term>
338
339 <listitem><para>Similar to
340 <varname>Requires=</varname>.
341 Dependencies listed in
342 <varname>RequiresOverridable=</varname>
343 which cannot be fulfilled or fail to
58c16a1a 344 start are ignored if the startup was
11e29955
LP
345 explicitly requested by the user. If
346 the start-up was pulled in indirectly
347 by some dependency or automatic
348 start-up of units that is not
349 requested by the user this dependency
350 must be fulfilled and otherwise the
351 transaction fails. Hence, this option
352 may be used to configure dependencies
4176e530 353 that are normally honored unless the
11e29955
LP
354 user explicitly starts up the unit, in
355 which case whether they failed or not
356 is irrelevant.</para></listitem>
357
358 </varlistentry>
359 <varlistentry>
360 <term><varname>Requisite=</varname></term>
361 <term><varname>RequisiteOverridable=</varname></term>
362
363 <listitem><para>Similar to
364 <varname>Requires=</varname>
365 resp. <varname>RequiresOverridable=</varname>. However,
366 if a unit listed here is not started
367 already it will not be started and the
368 transaction fails
369 immediately.</para></listitem>
370 </varlistentry>
371
372 <varlistentry>
373 <term><varname>Wants=</varname></term>
374
375 <listitem><para>A weaker version of
376 <varname>Requires=</varname>. A unit
377 listed in this option will be started
378 if the configuring unit is. However,
58c16a1a 379 if the listed unit fails to start up
11e29955
LP
380 or cannot be added to the transaction
381 this has no impact on the validity of
382 the transaction as a whole. This is
383 the recommended way to hook start-up
384 of one unit to the start-up of another
385 unit. Note that dependencies of this
386 type may also be configured outside of
387 the unit configuration file by
388 adding a symlink to a
389 <filename>.wants/</filename> directory
390 accompanying the unit file. For
391 details see above.</para></listitem>
392 </varlistentry>
393
b81884e7
LP
394 <varlistentry>
395 <term><varname>BindTo=</varname></term>
396
397 <listitem><para>Configures requirement
398 dependencies, very similar in style to
399 <varname>Requires=</varname>, however
400 in addition to this behaviour it also
401 declares that this unit is stopped
402 when any of the units listed suddenly
403 disappears. Units can suddenly,
404 unexpectedly disappear if a service
405 terminates on its own choice, a device
406 is unplugged or a mount point
21931dbe 407 unmounted without involvement of
b81884e7
LP
408 systemd.</para></listitem>
409 </varlistentry>
410
11e29955
LP
411 <varlistentry>
412 <term><varname>Conflicts=</varname></term>
413
414 <listitem><para>Configures negative
415 requirement dependencies. If a unit
58c16a1a 416 has a
11e29955 417 <varname>Conflicts=</varname> setting
58c16a1a 418 on another unit, starting the former
11e29955
LP
419 will stop the latter and vice
420 versa. Note that this setting is
421 independent of and orthogonal to the
422 <varname>After=</varname> and
423 <varname>Before=</varname> ordering
69dd2852
LP
424 dependencies.</para>
425
426 <para>If a unit A that conflicts with
427 a unit B is scheduled to be started at
428 the same time as B, the transaction
429 will either fail (in case both are
430 required part of the transaction) or
431 be modified to be fixed (in case one
432 or both jobs are not a required part
433 of the transaction). In the latter
434 case the job that is not the required
435 will be removed, or in case both are
436 not required the unit that conflicts
437 will be started and the unit that is
438 conflicted is
439 stopped.</para></listitem>
11e29955
LP
440 </varlistentry>
441
442 <varlistentry>
443 <term><varname>Before=</varname></term>
444 <term><varname>After=</varname></term>
445
446 <listitem><para>Configures ordering
447 dependencies between units. If a unit
448 <filename>foo.service</filename>
449 contains a setting
450 <option>Before=bar.service</option>
58c16a1a 451 and both units are being started,
11e29955
LP
452 <filename>bar.service</filename>'s
453 start-up is delayed until
454 <filename>foo.service</filename> is
455 started up. Note that this setting is
456 independent of and orthogonal to the
457 requirement dependencies as configured
458 by <varname>Requires=</varname>. It is
459 a common pattern to include a unit
460 name in both the
461 <varname>After=</varname> and
462 <varname>Requires=</varname> option in
463 which case the unit listed will be
464 started before the unit that is
465 configured with these options. This
466 option may be specified more than
467 once, in which case ordering
468 dependencies for all listed names are
469 created. <varname>After=</varname> is
470 the inverse of
471 <varname>Before=</varname>, i.e. while
472 <varname>After=</varname> ensures that
473 the configured unit is started after
474 the listed unit finished starting up,
475 <varname>Before=</varname> ensures the
476 opposite, i.e. that the configured
477 unit is fully started up before the
478 listed unit is started. Note that when
479 two units with an ordering dependency
480 between them are shut down, the
58c16a1a 481 inverse of the start-up order is
11e29955
LP
482 applied. i.e. if a unit is configured
483 with <varname>After=</varname> on
484 another unit, the former is stopped
485 before the latter if both are shut
486 down. If one unit with an ordering
487 dependency on another unit is shut
488 down while the latter is started up,
489 the shut down is ordered before the
490 start-up regardless whether the
491 ordering dependency is actually of
492 type <varname>After=</varname> or
493 <varname>Before=</varname>. If two
494 units have no ordering dependencies
495 between them they are shut down
496 resp. started up simultaneously, and
497 no ordering takes
498 place. </para></listitem>
499 </varlistentry>
500
b9975629
LP
501 <varlistentry>
502 <term><varname>OnFailure=</varname></term>
503
504 <listitem><para>Lists one or more
505 units that are activated when this
74ac3cbd
MM
506 unit enters the
507 '<literal>failed</literal>'
508 state.</para></listitem>
b9975629
LP
509 </varlistentry>
510
222ae6a8
LP
511 <varlistentry>
512 <term><varname>OnFailureIsolate=</varname></term>
513
514 <listitem><para>Takes a boolean
515 argument. If <option>true</option> the
516 unit listed in
517 <varname>OnFailure=</varname> will be
518 enqueued in isolation mode, i.e. all
519 units that are not its dependency will
520 be stopped. If this is set only a
521 single unit may be listed in
522 <varname>OnFailure=</varname>. Defaults
523 to
524 <option>false</option>.</para></listitem>
525 </varlistentry>
526
c8f4d764
LP
527 <varlistentry>
528 <term><varname>IgnoreOnIsolate=</varname></term>
529
530 <listitem><para>Takes a boolean
531 argument. If <option>true</option>
532 this unit will not be stopped when
533 isolating another unit. Defaults to
534 <option>false</option>.</para></listitem>
535 </varlistentry>
536
7a6000a6
LP
537 <varlistentry>
538 <term><varname>IgnoreOnSnapshot=</varname></term>
539
540 <listitem><para>Takes a boolean
541 argument. If <option>true</option>
542 this unit will not be included in
543 snapshots. Defaults to
4e7f8bc8
ZJS
544 <option>true</option> for device and
545 snapshot units, <option>false</option>
7a6000a6
LP
546 for the others.</para></listitem>
547 </varlistentry>
548
11e29955
LP
549 <varlistentry>
550 <term><varname>StopWhenUnneeded=</varname></term>
551
552 <listitem><para>Takes a boolean
553 argument. If <option>true</option>
554 this unit will be stopped when it is
555 no longer used. Note that in order to
58c16a1a
556 minimize the work to be executed,
557 systemd will not stop units by default
11e29955
LP
558 unless they are conflicting with other
559 units, or the user explicitly
560 requested their shut down. If this
58c16a1a 561 option is set, a unit will be
11e29955
LP
562 automatically cleaned up if no other
563 active unit requires it. Defaults to
564 <option>false</option>.</para></listitem>
565 </varlistentry>
566
567 <varlistentry>
b5e9dba8
LP
568 <term><varname>RefuseManualStart=</varname></term>
569 <term><varname>RefuseManualStop=</varname></term>
11e29955
LP
570
571 <listitem><para>Takes a boolean
572 argument. If <option>true</option>
58c16a1a 573 this unit can only be activated
b5e9dba8
LP
574 (resp. deactivated) indirectly. In
575 this case explicit start-up
576 (resp. termination) requested by the
577 user is denied, however if it is
578 started (resp. stopped) as a
58c16a1a 579 dependency of another unit, start-up
b5e9dba8
LP
580 (resp. termination) will succeed. This
581 is mostly a safety feature to ensure
582 that the user does not accidentally
583 activate units that are not intended
584 to be activated explicitly, and not
585 accidentally deactivate units that are
586 not intended to be deactivated.
587 These options default to
11e29955
LP
588 <option>false</option>.</para></listitem>
589 </varlistentry>
590
2528a7a6
LP
591 <varlistentry>
592 <term><varname>AllowIsolate=</varname></term>
593
594 <listitem><para>Takes a boolean
595 argument. If <option>true</option>
596 this unit may be used with the
597 <command>systemctl isolate</command>
598 command. Otherwise this will be
599 refused. It probably is a good idea to
600 leave this disabled except for target
601 units that shall be used similar to
602 runlevels in SysV init systems, just
603 as a precaution to avoid unusable
604 system states. This option defaults to
605 <option>false</option>.</para></listitem>
606 </varlistentry>
607
62adf224
LP
608 <varlistentry>
609 <term><varname>DefaultDependencies=</varname></term>
610
611 <listitem><para>Takes a boolean
612 argument. If <option>true</option>
613 (the default), a few default
614 dependencies will implicitly be
615 created for the unit. The actual
616 dependencies created depend on the
617 unit type. For example, for service
618 units, these dependencies ensure that
619 the service is started only after
620 basic system initialization is
58c16a1a 621 completed and is properly terminated on
62adf224
LP
622 system shutdown. See the respective
623 man pages for details. Generally, only
624 services involved with early boot or
625 late shutdown should set this option
626 to <option>false</option>. It is
627 highly recommended to leave this
628 option enabled for the majority of
629 common units. If set to
630 <option>false</option> this option
631 does not disable all implicit
632 dependencies, just non-essential
633 ones.</para></listitem>
634 </varlistentry>
635
b9975629
LP
636 <varlistentry>
637 <term><varname>JobTimeoutSec=</varname></term>
638
639 <listitem><para>When clients are
640 waiting for a job of this unit to
641 complete, time out after the specified
642 time. If this time limit is reached
643 the job will be cancelled, the unit
644 however will not change state or even
74ac3cbd
MM
645 enter the '<literal>failed</literal>'
646 mode. This value defaults to 0 (job
647 timeouts disabled), except for device
648 units. NB: this timeout is independent
649 from any unit-specific timeout (for
650 example, the timeout set with
b9975629 651 <varname>Timeout=</varname> in service
74ac3cbd
MM
652 units) as the job timeout has no
653 effect on the unit itself, only on the
654 job that might be pending for it. Or
655 in other words: unit-specific timeouts
b9975629
LP
656 are useful to abort unit state
657 changes, and revert them. The job
658 timeout set with this option however
74ac3cbd
MM
659 is useful to abort only the job
660 waiting for the unit state to
661 change.</para></listitem>
b9975629
LP
662 </varlistentry>
663
52661efd
LP
664 <varlistentry>
665 <term><varname>ConditionPathExists=</varname></term>
8092a428 666 <term><varname>ConditionPathExistsGlob=</varname></term>
c61e77d3 667 <term><varname>ConditionPathIsDirectory=</varname></term>
ab7f148f 668 <term><varname>ConditionPathIsMountPoint=</varname></term>
36af55d9 669 <term><varname>ConditionDirectoryNotEmpty=</varname></term>
82e487c5 670 <term><varname>ConditionFileIsExecutable=</varname></term>
52661efd 671 <term><varname>ConditionKernelCommandLine=</varname></term>
039655a4 672 <term><varname>ConditionVirtualization=</varname></term>
69528c31 673 <term><varname>ConditionSecurity=</varname></term>
d257ddef 674 <term><varname>ConditionNull=</varname></term>
52661efd
LP
675
676 <listitem><para>Before starting a unit
677 verify that the specified condition is
678 true. With
679 <varname>ConditionPathExists=</varname>
9f7dad77 680 a file existence condition can be
52661efd
LP
681 checked before a unit is started. If
682 the specified absolute path name does
418112a2 683 not exist, startup of a unit will not
52661efd
LP
684 actually happen, however the unit is
685 still useful for ordering purposes in
686 this case. The condition is checked at
687 the time the queued start job is to be
688 executed. If the absolute path name
689 passed to
690 <varname>ConditionPathExists=</varname>
691 is prefixed with an exclamation mark
692 (!), the test is negated, and the unit
418112a2
MS
693 is only started if the path does not
694 exist. The test follows symlinks.
695 <varname>ConditionPathExistsGlob=</varname>
696 works in a similar way, but checks for
697 the existence of at least one file or
8092a428 698 directory matching the specified
ab7f148f
LP
699 globbing
700 pattern. <varname>ConditionPathIsDirectory=</varname>
701 is similar to
702 <varname>ConditionPathExists=</varname>
703 but verifies whether a certain path
704 exists and is a directory. It does not
705 follow
706 symlinks. <varname>ConditionPathIsMountPoint=</varname>
707 is similar to
708 <varname>ConditionPathExists=</varname>
709 but verifies whether a certain path
710 exists and is a mount
711 point. <varname>ConditionFileIsExecutable=</varname>
712 is similar to
713 <varname>ConditionPathExists=</varname>
714 but verifies whether a certain path
715 exists, is a regular file and marked
716 executable. It follows symlinks.
c61e77d3
LP
717 <varname>ConditionDirectoryNotEmpty=</varname>
718 is similar to
719 <varname>ConditionPathExists=</varname>
720 but verifies whether a certain path
36af55d9
LP
721 exists and is a non-empty
722 directory. Similarly
52661efd
LP
723 <varname>ConditionKernelCommandLine=</varname>
724 may be used to check whether a
725 specific kernel command line option is
726 set (or if prefixed with the
727 exclamation mark unset). The argument
728 must either be a single word, or an
5471472d 729 assignment (i.e. two words, separated
52661efd 730 by the equality sign). In the former
d257ddef
LP
731 case the kernel command line is
732 searched for the word appearing as is,
733 or as left hand side of an
734 assignment. In the latter case the
735 exact assignment is looked for with
736 right and left hand side
039655a4
LP
737 matching. <varname>ConditionVirtualization=</varname>
738 may be used to check whether the
739 system is executed in a virtualized
740 environment and optionally test
741 whether it is a specific
742 implementation. Takes either boolean
267632f0
LP
743 value to check if being executed in
744 any virtual environment or one of the
039655a4
LP
745 <varname>qemu</varname>,
746 <varname>kvm</varname>,
747 <varname>vmware</varname>,
748 <varname>microsoft</varname>,
749 <varname>oracle</varname>,
750 <varname>xen</varname>,
28cf382a 751 <varname>pidns</varname>,
039655a4
LP
752 <varname>openvz</varname> to test
753 against a specific implementation. The
754 test may be negated by prepending an
69528c31
MS
755 exclamation mark.
756 <varname>ConditionSecurity=</varname>
8092a428
LP
757 may be used to check whether the given
758 security module is enabled on the
759 system. Currently the only recognized
760 value is <varname>selinux</varname>.
761 The test may be negated by prepending
762 an exclamation mark. Finally,
d257ddef
LP
763 <varname>ConditionNull=</varname> may
764 be used to add a constant condition
765 check value to the unit. It takes a
766 boolean argument. If set to
767 <varname>false</varname> the condition
768 will always fail, otherwise
769 succeed. If multiple conditions are
039655a4 770 specified the unit will be executed if
267632f0
LP
771 all of them apply (i.e. a logical AND
772 is applied). Condition checks can be
773 prefixed with a pipe symbol (|) in
774 which case a condition becomes a
775 triggering condition. If at least one
776 triggering condition is defined for a
777 unit then the unit will be executed if
778 at least one of the triggering
779 conditions apply and all of the
780 non-triggering conditions. If you
781 prefix an argument with the pipe
782 symbol and an exclamation mark the
783 pipe symbol must be passed first, the
784 exclamation second.</para></listitem>
52661efd 785 </varlistentry>
e2130f18
LP
786
787 <varlistentry>
788 <term><varname>Names=</varname></term>
789
790 <listitem><para>Additional names for
791 this unit. The names listed here must
792 have the same suffix (i.e. type) as
793 the unit file name. This option may be
794 specified more than once, in which
795 case all listed names are used. Note
796 that this option is different from the
797 <varname>Alias=</varname> option from
798 the [Install] section mentioned
799 below. See below for details. Note
800 that in almost all cases this option
801 is not what you want. A symlink alias
802 in the file system is generally
803 preferable since it can be used as
804 lookup key. If a unit with a symlinked
805 alias name is not loaded and needs to
806 be it is easily found via the
807 symlink. However, if a unit with an
808 alias name configured with this
809 setting is not loaded it will not be
810 discovered. This settings' only use is
811 in conjunction with service
812 instances.</para>
813 </listitem>
814 </varlistentry>
d1ab0ca0 815 </variablelist>
771610b0
LP
816
817 <para>Unit file may include a [Install] section, which
818 carries installation information for the unit. This
819 section is not interpreted by
820 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
821 during runtime. It is used exclusively by the
ee5762e3
LP
822 <command>enable</command> and
823 <command>disable</command> commands of the
824 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
11e29955 825 tool during installation of a unit:</para>
771610b0
LP
826
827 <variablelist>
828 <varlistentry>
829 <term><varname>Alias=</varname></term>
830
0a715d97 831 <listitem><para>Additional names this
771610b0
LP
832 unit shall be installed under. The
833 names listed here must have the same
834 suffix (i.e. type) as the unit file
835 name. This option may be specified
836 more than once, in which case all
837 listed names are used. At installation
af62c704 838 time,
ee5762e3 839 <command>systemctl enable</command>
771610b0
LP
840 will create symlinks from these names
841 to the unit file name. Note that this
842 is different from the
843 <varname>Names=</varname> option from
844 the [Unit] section mentioned above:
845 The names from
846 <varname>Names=</varname> apply
847 unconditionally if the unit is
848 loaded. The names from
849 <varname>Alias=</varname> apply only
11e29955
LP
850 if the unit has actually been
851 installed with the
ee5762e3
LP
852 <command>systemctl enable</command>
853 command. Also, if systemd searches for a
771610b0 854 unit, it will discover symlinked alias
11e29955
LP
855 names as configured with
856 <varname>Alias=</varname>, but not
857 names configured with
858 <varname>Names=</varname> only. It is
859 a common pattern to list a name in
860 both options. In this case, a unit
861 will be active under all names if
862 installed, but also if not installed
863 but requested explicitly under its
864 main name.</para></listitem>
865 </varlistentry>
866
867 <varlistentry>
868 <term><varname>WantedBy=</varname></term>
869
870 <listitem><para>Installs a symlink in
871 the <filename>.wants/</filename>
872 subdirectory for a unit. This has the
873 effect that when the listed unit name
874 is activated the unit listing it is
875 activated
6cbdbc5f 876 too. <command>WantedBy=foo.service</command>
11e29955
LP
877 in a service
878 <filename>bar.service</filename> is
879 mostly equivalent to
880 <command>Alias=foo.service.wants/bar.service</command>
881 in the same file.</para></listitem>
882 </varlistentry>
883
884 <varlistentry>
885 <term><varname>Also=</varname></term>
886
887 <listitem><para>Additional units to
888 install when this unit is
889 installed. If the user requests
890 installation of a unit with this
58c16a1a 891 option configured,
ee5762e3 892 <command>systemctl enable</command>
11e29955
LP
893 will automatically install units
894 listed in this option as
895 well.</para></listitem>
771610b0
LP
896 </varlistentry>
897 </variablelist>
898
d1ab0ca0
LP
899 </refsect1>
900
901 <refsect1>
160cd5c9
LP
902 <title>See Also</title>
903 <para>
904 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
771610b0 905 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
771610b0
LP
906 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
907 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
908 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
909 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
910 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
911 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
912 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
913 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
914 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
5f2ee303
LP
915 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
916 <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry>
160cd5c9 917 </para>
d1ab0ca0
LP
918 </refsect1>
919
920</refentry>