]>
Commit | Line | Data |
---|---|---|
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 OÇ |
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 LP |
141 | tool which reads information from the [Install] |
142 | section of unit files. (See below.)</para> | |
143 | ||
144 | <para>Note that while systemd offers a flexible | |
145 | dependency system between units it is recommended to | |
146 | use this functionality only sparsely and instead rely | |
147 | on techniques such as bus-based or socket-based | |
148 | activation which makes dependencies implicit, which | |
149 | both results in a simpler and more flexible | |
150 | system.</para> | |
1f812fea LP |
151 | |
152 | <para>Some unit names reflect paths existing in the | |
153 | file system name space. Example: a device unit | |
154 | <filename>dev-sda.device</filename> refers to a device | |
155 | with the device node <filename>/dev/sda</filename> in | |
156 | the file system namespace. If this applies a special | |
085b94ee LP |
157 | way to escape the path name is used, so that the |
158 | result is usable as part of a file name. Basically, | |
159 | given a path, "/" is replaced by "-", and all | |
160 | unprintable characters and the "-" are replaced by | |
161 | C-style "\x20" escapes. The root directory "/" is | |
162 | encoded as single dash, while otherwise the initial | |
163 | and ending "/" is removed from all paths during | |
164 | transformation. This escaping is reversible.</para> | |
1f812fea LP |
165 | |
166 | <para>Optionally, units may be instantiated from a | |
167 | template file at runtime. This allows creation of | |
168 | multiple units from a single configuration file. If | |
169 | systemd looks for a unit configuration file it will | |
170 | first search for the literal unit name in the | |
171 | filesystem. If that yields no success and the unit | |
172 | name contains an @ character, systemd will look for a | |
173 | unit template that shares the same name but with the | |
174 | instance string (i.e. the part between the @ character | |
175 | and the suffix) removed. Example: if a service | |
176 | <filename>getty@tty3.service</filename> is requested | |
177 | and no file by that name is found, systemd will look | |
178 | for <filename>getty@.service</filename> and | |
179 | instantiate a service from that configuration file if | |
180 | it is found. To refer to the instance string from | |
181 | within the configuration file you may use the special | |
182 | <literal>%i</literal> specifier in many of the | |
183 | configuration options. Other specifiers that may be | |
184 | used are <literal>%n</literal>, <literal>%N</literal>, | |
9fc50704 LP |
185 | <literal>%p</literal>, <literal>%P</literal>, |
186 | <literal>%I</literal> and <literal>%f</literal>, for | |
187 | the full unit name, the unescaped unit name, the | |
188 | prefix name, the unescaped prefix name, the unescaped | |
189 | instance name and the unescaped filename, | |
190 | respectively. The unescaped filename is either the | |
191 | unescaped instance name (if set) with / prepended (if | |
192 | necessary), or the prefix name similarly prepended | |
193 | with /. The prefix name here refers to the string | |
194 | before the @, i.e. "getty" in the example above, where | |
195 | "tty3" is the instance name.</para> | |
b9aea954 | 196 | |
6daf4f90 LP |
197 | <para>If a unit file is empty (i.e. has the file size |
198 | 0) or is symlinked to <filename>/dev/null</filename> | |
199 | its configuration will not be loaded and it appears | |
200 | with a load state of <literal>masked</literal>, and | |
201 | cannot be activated. Use this as an effective way to | |
202 | fully disable a unit, making it impossible to start it | |
203 | even manually.</para> | |
204 | ||
b9aea954 LP |
205 | <para>The unit file format is covered by the |
206 | <ulink | |
207 | url="http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface | |
208 | Stability Promise</ulink>.</para> | |
d1ab0ca0 LP |
209 | </refsect1> |
210 | ||
211 | <refsect1> | |
212 | <title>Options</title> | |
213 | ||
771610b0 LP |
214 | <para>Unit file may include a [Unit] section, which |
215 | carries generic information about the unit that is not | |
216 | dependent on the type of unit:</para> | |
217 | ||
d1ab0ca0 LP |
218 | <variablelist> |
219 | <varlistentry> | |
9f235308 | 220 | <term><varname>Names=</varname></term> |
771610b0 LP |
221 | |
222 | <listitem><para>Additional names for | |
223 | this unit. The names listed here must | |
224 | have the same suffix (i.e. type) as | |
225 | the unit file name. This option may be | |
226 | specified more than once, in which | |
227 | case all listed names are used. Note | |
228 | that this option is different from the | |
229 | <varname>Alias=</varname> option from | |
230 | the [Install] section mentioned | |
11e29955 | 231 | below. See below for details.</para> |
d1ab0ca0 LP |
232 | </listitem> |
233 | </varlistentry> | |
11e29955 LP |
234 | |
235 | <varlistentry> | |
236 | <term><varname>Description=</varname></term> | |
237 | <listitem><para>A free-form string | |
62adf224 LP |
238 | describing the unit. This is intended |
239 | for use in UIs to show descriptive | |
240 | information along with the unit | |
241 | name.</para></listitem> | |
11e29955 LP |
242 | </varlistentry> |
243 | ||
d1ab0ca0 | 244 | <varlistentry> |
9f235308 | 245 | <term><varname>Requires=</varname></term> |
771610b0 | 246 | |
11e29955 | 247 | <listitem><para>Configures requirement |
771610b0 | 248 | dependencies on other units. If this |
58c16a1a | 249 | unit gets activated, the units listed |
771610b0 LP |
250 | here will be activated as well. If one |
251 | of the other units gets deactivated or | |
252 | its activation fails, this unit will | |
253 | be deactivated. This option may be | |
254 | specified more than once, in which | |
255 | case requirement dependencies for all | |
11e29955 LP |
256 | listed names are created. Note that |
257 | requirement dependencies do not | |
258 | influence the order in which services | |
259 | are started or stopped. This has to be | |
260 | configured independently with the | |
261 | <varname>After=</varname> or | |
262 | <varname>Before=</varname> options. If | |
263 | a unit | |
264 | <filename>foo.service</filename> | |
265 | requires a unit | |
266 | <filename>bar.service</filename> as | |
267 | configured with | |
268 | <varname>Requires=</varname> and no | |
269 | ordering is configured with | |
270 | <varname>After=</varname> or | |
271 | <varname>Before=</varname>, then both | |
272 | units will be started simultaneously | |
273 | and without any delay between them if | |
274 | <filename>foo.service</filename> is | |
275 | activated. Often it is a better choice | |
276 | to use <varname>Wants=</varname> | |
277 | instead of | |
278 | <varname>Requires=</varname> in order | |
279 | to achieve a system that is more | |
280 | robust when dealing with failing | |
281 | services.</para></listitem> | |
d1ab0ca0 | 282 | </varlistentry> |
11e29955 | 283 | |
11e29955 LP |
284 | <varlistentry> |
285 | <term><varname>RequiresOverridable=</varname></term> | |
286 | ||
287 | <listitem><para>Similar to | |
288 | <varname>Requires=</varname>. | |
289 | Dependencies listed in | |
290 | <varname>RequiresOverridable=</varname> | |
291 | which cannot be fulfilled or fail to | |
58c16a1a | 292 | start are ignored if the startup was |
11e29955 LP |
293 | explicitly requested by the user. If |
294 | the start-up was pulled in indirectly | |
295 | by some dependency or automatic | |
296 | start-up of units that is not | |
297 | requested by the user this dependency | |
298 | must be fulfilled and otherwise the | |
299 | transaction fails. Hence, this option | |
300 | may be used to configure dependencies | |
4176e530 | 301 | that are normally honored unless the |
11e29955 LP |
302 | user explicitly starts up the unit, in |
303 | which case whether they failed or not | |
304 | is irrelevant.</para></listitem> | |
305 | ||
306 | </varlistentry> | |
307 | <varlistentry> | |
308 | <term><varname>Requisite=</varname></term> | |
309 | <term><varname>RequisiteOverridable=</varname></term> | |
310 | ||
311 | <listitem><para>Similar to | |
312 | <varname>Requires=</varname> | |
313 | resp. <varname>RequiresOverridable=</varname>. However, | |
314 | if a unit listed here is not started | |
315 | already it will not be started and the | |
316 | transaction fails | |
317 | immediately.</para></listitem> | |
318 | </varlistentry> | |
319 | ||
320 | <varlistentry> | |
321 | <term><varname>Wants=</varname></term> | |
322 | ||
323 | <listitem><para>A weaker version of | |
324 | <varname>Requires=</varname>. A unit | |
325 | listed in this option will be started | |
326 | if the configuring unit is. However, | |
58c16a1a | 327 | if the listed unit fails to start up |
11e29955 LP |
328 | or cannot be added to the transaction |
329 | this has no impact on the validity of | |
330 | the transaction as a whole. This is | |
331 | the recommended way to hook start-up | |
332 | of one unit to the start-up of another | |
333 | unit. Note that dependencies of this | |
334 | type may also be configured outside of | |
335 | the unit configuration file by | |
336 | adding a symlink to a | |
337 | <filename>.wants/</filename> directory | |
338 | accompanying the unit file. For | |
339 | details see above.</para></listitem> | |
340 | </varlistentry> | |
341 | ||
b81884e7 LP |
342 | <varlistentry> |
343 | <term><varname>BindTo=</varname></term> | |
344 | ||
345 | <listitem><para>Configures requirement | |
346 | dependencies, very similar in style to | |
347 | <varname>Requires=</varname>, however | |
348 | in addition to this behaviour it also | |
349 | declares that this unit is stopped | |
350 | when any of the units listed suddenly | |
351 | disappears. Units can suddenly, | |
352 | unexpectedly disappear if a service | |
353 | terminates on its own choice, a device | |
354 | is unplugged or a mount point | |
355 | unmounted with involvement of | |
356 | systemd.</para></listitem> | |
357 | </varlistentry> | |
358 | ||
11e29955 LP |
359 | <varlistentry> |
360 | <term><varname>Conflicts=</varname></term> | |
361 | ||
362 | <listitem><para>Configures negative | |
363 | requirement dependencies. If a unit | |
58c16a1a | 364 | has a |
11e29955 | 365 | <varname>Conflicts=</varname> setting |
58c16a1a | 366 | on another unit, starting the former |
11e29955 LP |
367 | will stop the latter and vice |
368 | versa. Note that this setting is | |
369 | independent of and orthogonal to the | |
370 | <varname>After=</varname> and | |
371 | <varname>Before=</varname> ordering | |
69dd2852 LP |
372 | dependencies.</para> |
373 | ||
374 | <para>If a unit A that conflicts with | |
375 | a unit B is scheduled to be started at | |
376 | the same time as B, the transaction | |
377 | will either fail (in case both are | |
378 | required part of the transaction) or | |
379 | be modified to be fixed (in case one | |
380 | or both jobs are not a required part | |
381 | of the transaction). In the latter | |
382 | case the job that is not the required | |
383 | will be removed, or in case both are | |
384 | not required the unit that conflicts | |
385 | will be started and the unit that is | |
386 | conflicted is | |
387 | stopped.</para></listitem> | |
11e29955 LP |
388 | </varlistentry> |
389 | ||
390 | <varlistentry> | |
391 | <term><varname>Before=</varname></term> | |
392 | <term><varname>After=</varname></term> | |
393 | ||
394 | <listitem><para>Configures ordering | |
395 | dependencies between units. If a unit | |
396 | <filename>foo.service</filename> | |
397 | contains a setting | |
398 | <option>Before=bar.service</option> | |
58c16a1a | 399 | and both units are being started, |
11e29955 LP |
400 | <filename>bar.service</filename>'s |
401 | start-up is delayed until | |
402 | <filename>foo.service</filename> is | |
403 | started up. Note that this setting is | |
404 | independent of and orthogonal to the | |
405 | requirement dependencies as configured | |
406 | by <varname>Requires=</varname>. It is | |
407 | a common pattern to include a unit | |
408 | name in both the | |
409 | <varname>After=</varname> and | |
410 | <varname>Requires=</varname> option in | |
411 | which case the unit listed will be | |
412 | started before the unit that is | |
413 | configured with these options. This | |
414 | option may be specified more than | |
415 | once, in which case ordering | |
416 | dependencies for all listed names are | |
417 | created. <varname>After=</varname> is | |
418 | the inverse of | |
419 | <varname>Before=</varname>, i.e. while | |
420 | <varname>After=</varname> ensures that | |
421 | the configured unit is started after | |
422 | the listed unit finished starting up, | |
423 | <varname>Before=</varname> ensures the | |
424 | opposite, i.e. that the configured | |
425 | unit is fully started up before the | |
426 | listed unit is started. Note that when | |
427 | two units with an ordering dependency | |
428 | between them are shut down, the | |
58c16a1a | 429 | inverse of the start-up order is |
11e29955 LP |
430 | applied. i.e. if a unit is configured |
431 | with <varname>After=</varname> on | |
432 | another unit, the former is stopped | |
433 | before the latter if both are shut | |
434 | down. If one unit with an ordering | |
435 | dependency on another unit is shut | |
436 | down while the latter is started up, | |
437 | the shut down is ordered before the | |
438 | start-up regardless whether the | |
439 | ordering dependency is actually of | |
440 | type <varname>After=</varname> or | |
441 | <varname>Before=</varname>. If two | |
442 | units have no ordering dependencies | |
443 | between them they are shut down | |
444 | resp. started up simultaneously, and | |
445 | no ordering takes | |
446 | place. </para></listitem> | |
447 | </varlistentry> | |
448 | ||
b9975629 LP |
449 | <varlistentry> |
450 | <term><varname>OnFailure=</varname></term> | |
451 | ||
452 | <listitem><para>Lists one or more | |
453 | units that are activated when this | |
74ac3cbd MM |
454 | unit enters the |
455 | '<literal>failed</literal>' | |
456 | state.</para></listitem> | |
b9975629 LP |
457 | </varlistentry> |
458 | ||
11e29955 LP |
459 | <varlistentry> |
460 | <term><varname>StopWhenUnneeded=</varname></term> | |
461 | ||
462 | <listitem><para>Takes a boolean | |
463 | argument. If <option>true</option> | |
464 | this unit will be stopped when it is | |
465 | no longer used. Note that in order to | |
58c16a1a OÇ |
466 | minimize the work to be executed, |
467 | systemd will not stop units by default | |
11e29955 LP |
468 | unless they are conflicting with other |
469 | units, or the user explicitly | |
470 | requested their shut down. If this | |
58c16a1a | 471 | option is set, a unit will be |
11e29955 LP |
472 | automatically cleaned up if no other |
473 | active unit requires it. Defaults to | |
474 | <option>false</option>.</para></listitem> | |
475 | </varlistentry> | |
476 | ||
477 | <varlistentry> | |
b5e9dba8 LP |
478 | <term><varname>RefuseManualStart=</varname></term> |
479 | <term><varname>RefuseManualStop=</varname></term> | |
11e29955 LP |
480 | |
481 | <listitem><para>Takes a boolean | |
482 | argument. If <option>true</option> | |
58c16a1a | 483 | this unit can only be activated |
b5e9dba8 LP |
484 | (resp. deactivated) indirectly. In |
485 | this case explicit start-up | |
486 | (resp. termination) requested by the | |
487 | user is denied, however if it is | |
488 | started (resp. stopped) as a | |
58c16a1a | 489 | dependency of another unit, start-up |
b5e9dba8 LP |
490 | (resp. termination) will succeed. This |
491 | is mostly a safety feature to ensure | |
492 | that the user does not accidentally | |
493 | activate units that are not intended | |
494 | to be activated explicitly, and not | |
495 | accidentally deactivate units that are | |
496 | not intended to be deactivated. | |
497 | These options default to | |
11e29955 LP |
498 | <option>false</option>.</para></listitem> |
499 | </varlistentry> | |
500 | ||
2528a7a6 LP |
501 | <varlistentry> |
502 | <term><varname>AllowIsolate=</varname></term> | |
503 | ||
504 | <listitem><para>Takes a boolean | |
505 | argument. If <option>true</option> | |
506 | this unit may be used with the | |
507 | <command>systemctl isolate</command> | |
508 | command. Otherwise this will be | |
509 | refused. It probably is a good idea to | |
510 | leave this disabled except for target | |
511 | units that shall be used similar to | |
512 | runlevels in SysV init systems, just | |
513 | as a precaution to avoid unusable | |
514 | system states. This option defaults to | |
515 | <option>false</option>.</para></listitem> | |
516 | </varlistentry> | |
517 | ||
62adf224 LP |
518 | <varlistentry> |
519 | <term><varname>DefaultDependencies=</varname></term> | |
520 | ||
521 | <listitem><para>Takes a boolean | |
522 | argument. If <option>true</option> | |
523 | (the default), a few default | |
524 | dependencies will implicitly be | |
525 | created for the unit. The actual | |
526 | dependencies created depend on the | |
527 | unit type. For example, for service | |
528 | units, these dependencies ensure that | |
529 | the service is started only after | |
530 | basic system initialization is | |
58c16a1a | 531 | completed and is properly terminated on |
62adf224 LP |
532 | system shutdown. See the respective |
533 | man pages for details. Generally, only | |
534 | services involved with early boot or | |
535 | late shutdown should set this option | |
536 | to <option>false</option>. It is | |
537 | highly recommended to leave this | |
538 | option enabled for the majority of | |
539 | common units. If set to | |
540 | <option>false</option> this option | |
541 | does not disable all implicit | |
542 | dependencies, just non-essential | |
543 | ones.</para></listitem> | |
544 | </varlistentry> | |
545 | ||
b9975629 LP |
546 | <varlistentry> |
547 | <term><varname>JobTimeoutSec=</varname></term> | |
548 | ||
549 | <listitem><para>When clients are | |
550 | waiting for a job of this unit to | |
551 | complete, time out after the specified | |
552 | time. If this time limit is reached | |
553 | the job will be cancelled, the unit | |
554 | however will not change state or even | |
74ac3cbd MM |
555 | enter the '<literal>failed</literal>' |
556 | mode. This value defaults to 0 (job | |
557 | timeouts disabled), except for device | |
558 | units. NB: this timeout is independent | |
559 | from any unit-specific timeout (for | |
560 | example, the timeout set with | |
b9975629 | 561 | <varname>Timeout=</varname> in service |
74ac3cbd MM |
562 | units) as the job timeout has no |
563 | effect on the unit itself, only on the | |
564 | job that might be pending for it. Or | |
565 | in other words: unit-specific timeouts | |
b9975629 LP |
566 | are useful to abort unit state |
567 | changes, and revert them. The job | |
568 | timeout set with this option however | |
74ac3cbd MM |
569 | is useful to abort only the job |
570 | waiting for the unit state to | |
571 | change.</para></listitem> | |
b9975629 LP |
572 | </varlistentry> |
573 | ||
52661efd LP |
574 | <varlistentry> |
575 | <term><varname>ConditionPathExists=</varname></term> | |
576 | <term><varname>ConditionKernelCommandLine=</varname></term> | |
577 | ||
578 | <listitem><para>Before starting a unit | |
579 | verify that the specified condition is | |
580 | true. With | |
581 | <varname>ConditionPathExists=</varname> | |
582 | a file existance condition can be | |
583 | checked before a unit is started. If | |
584 | the specified absolute path name does | |
585 | not exist startup of a unit will not | |
586 | actually happen, however the unit is | |
587 | still useful for ordering purposes in | |
588 | this case. The condition is checked at | |
589 | the time the queued start job is to be | |
590 | executed. If the absolute path name | |
591 | passed to | |
592 | <varname>ConditionPathExists=</varname> | |
593 | is prefixed with an exclamation mark | |
594 | (!), the test is negated, and the unit | |
595 | only started if the path does not | |
596 | exist. Similarly | |
597 | <varname>ConditionKernelCommandLine=</varname> | |
598 | may be used to check whether a | |
599 | specific kernel command line option is | |
600 | set (or if prefixed with the | |
601 | exclamation mark unset). The argument | |
602 | must either be a single word, or an | |
603 | assignment (i.e. two words, seperated | |
604 | by the equality sign). In the former | |
605 | case the kernel command line is search | |
606 | for the word appearing as is, or as | |
607 | left hand side of an assignment. In | |
608 | the latter case the exact assignment | |
609 | is looked for with right and left hand | |
610 | side matching. If multiple conditions | |
611 | are specified the unit will be | |
612 | executed iff at least one of them | |
b81884e7 | 613 | applies (i.e. a logical OR is |
52661efd LP |
614 | applied).</para></listitem> |
615 | </varlistentry> | |
d1ab0ca0 | 616 | </variablelist> |
771610b0 LP |
617 | |
618 | <para>Unit file may include a [Install] section, which | |
619 | carries installation information for the unit. This | |
620 | section is not interpreted by | |
621 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
622 | during runtime. It is used exclusively by the | |
ee5762e3 LP |
623 | <command>enable</command> and |
624 | <command>disable</command> commands of the | |
625 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
11e29955 | 626 | tool during installation of a unit:</para> |
771610b0 LP |
627 | |
628 | <variablelist> | |
629 | <varlistentry> | |
630 | <term><varname>Alias=</varname></term> | |
631 | ||
0a715d97 | 632 | <listitem><para>Additional names this |
771610b0 LP |
633 | unit shall be installed under. The |
634 | names listed here must have the same | |
635 | suffix (i.e. type) as the unit file | |
636 | name. This option may be specified | |
637 | more than once, in which case all | |
638 | listed names are used. At installation | |
af62c704 | 639 | time, |
ee5762e3 | 640 | <command>systemctl enable</command> |
771610b0 LP |
641 | will create symlinks from these names |
642 | to the unit file name. Note that this | |
643 | is different from the | |
644 | <varname>Names=</varname> option from | |
645 | the [Unit] section mentioned above: | |
646 | The names from | |
647 | <varname>Names=</varname> apply | |
648 | unconditionally if the unit is | |
649 | loaded. The names from | |
650 | <varname>Alias=</varname> apply only | |
11e29955 LP |
651 | if the unit has actually been |
652 | installed with the | |
ee5762e3 LP |
653 | <command>systemctl enable</command> |
654 | command. Also, if systemd searches for a | |
771610b0 | 655 | unit, it will discover symlinked alias |
11e29955 LP |
656 | names as configured with |
657 | <varname>Alias=</varname>, but not | |
658 | names configured with | |
659 | <varname>Names=</varname> only. It is | |
660 | a common pattern to list a name in | |
661 | both options. In this case, a unit | |
662 | will be active under all names if | |
663 | installed, but also if not installed | |
664 | but requested explicitly under its | |
665 | main name.</para></listitem> | |
666 | </varlistentry> | |
667 | ||
668 | <varlistentry> | |
669 | <term><varname>WantedBy=</varname></term> | |
670 | ||
671 | <listitem><para>Installs a symlink in | |
672 | the <filename>.wants/</filename> | |
673 | subdirectory for a unit. This has the | |
674 | effect that when the listed unit name | |
675 | is activated the unit listing it is | |
676 | activated | |
6cbdbc5f | 677 | too. <command>WantedBy=foo.service</command> |
11e29955 LP |
678 | in a service |
679 | <filename>bar.service</filename> is | |
680 | mostly equivalent to | |
681 | <command>Alias=foo.service.wants/bar.service</command> | |
682 | in the same file.</para></listitem> | |
683 | </varlistentry> | |
684 | ||
685 | <varlistentry> | |
686 | <term><varname>Also=</varname></term> | |
687 | ||
688 | <listitem><para>Additional units to | |
689 | install when this unit is | |
690 | installed. If the user requests | |
691 | installation of a unit with this | |
58c16a1a | 692 | option configured, |
ee5762e3 | 693 | <command>systemctl enable</command> |
11e29955 LP |
694 | will automatically install units |
695 | listed in this option as | |
696 | well.</para></listitem> | |
771610b0 LP |
697 | </varlistentry> |
698 | </variablelist> | |
699 | ||
d1ab0ca0 LP |
700 | </refsect1> |
701 | ||
702 | <refsect1> | |
160cd5c9 LP |
703 | <title>See Also</title> |
704 | <para> | |
705 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
771610b0 | 706 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
771610b0 LP |
707 | <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
708 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
709 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
710 | <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
711 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
712 | <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
713 | <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
714 | <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
715 | <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
5f2ee303 LP |
716 | <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
717 | <citerefentry><refentrytitle>systemd.snapshot</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
160cd5c9 | 718 | </para> |
d1ab0ca0 LP |
719 | </refsect1> |
720 | ||
721 | </refentry> |