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