]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.unit.xml
unit: rework a bit how we keep the service fdstore from being destroyed during servic...
[thirdparty/systemd.git] / man / systemd.unit.xml
CommitLineData
c129bd5d 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
d1ab0ca0 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
798d3a52 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
1a13e31d
ZJS
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
798d3a52
ZJS
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>
50 <refpurpose>Unit configuration</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
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>,
798d3a52
ZJS
63 <filename><replaceable>slice</replaceable>.slice</filename>,
64 <filename><replaceable>scope</replaceable>.scope</filename></para>
65
12b42c76 66 <para><literallayout><filename>/etc/systemd/system/*</filename>
13219b7f 67<filename>/run/systemd/system/*</filename>
12b42c76 68<filename>/usr/lib/systemd/system/*</filename>
f6e1bd2c 69<filename>…</filename>
798d3a52 70 </literallayout></para>
13219b7f 71
f6e1bd2c 72 <para><literallayout><filename>~/.config/systemd/user/*</filename>
12b42c76 73<filename>/etc/systemd/user/*</filename>
aa08982d 74<filename>$XDG_RUNTIME_DIR/systemd/user/*</filename>
13219b7f 75<filename>/run/systemd/user/*</filename>
f6e1bd2c 76<filename>~/.local/share/systemd/user/*</filename>
12b42c76 77<filename>/usr/lib/systemd/user/*</filename>
f6e1bd2c 78<filename>…</filename>
798d3a52
ZJS
79 </literallayout></para>
80 </refsynopsisdiv>
81
82 <refsect1>
83 <title>Description</title>
84
85 <para>A unit configuration file encodes information about a
86 service, a socket, a device, a mount point, an automount point, a
87 swap file or partition, a start-up target, a watched file system
88 path, a timer controlled and supervised by
89 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
36b4a7ba 90 a resource management slice or
798d3a52
ZJS
91 a group of externally created processes. The syntax is inspired by
92 <ulink
93 url="http://standards.freedesktop.org/desktop-entry-spec/latest/">XDG
94 Desktop Entry Specification</ulink> <filename>.desktop</filename>
95 files, which are in turn inspired by Microsoft Windows
96 <filename>.ini</filename> files.</para>
97
98 <para>This man page lists the common configuration options of all
99 the unit types. These options need to be configured in the [Unit]
100 or [Install] sections of the unit files.</para>
101
102 <para>In addition to the generic [Unit] and [Install] sections
103 described here, each unit may have a type-specific section, e.g.
104 [Service] for a service unit. See the respective man pages for
105 more information:
106 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
107 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
108 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
109 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
110 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
36b4a7ba 115 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
798d3a52
ZJS
116 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
117 </para>
118
119 <para>Various settings are allowed to be specified more than once,
120 in which case the interpretation depends on the setting. Often,
121 multiple settings form a list, and setting to an empty value
122 "resets", which means that previous assignments are ignored. When
123 this is allowed, it is mentioned in the description of the
124 setting. Note that using multiple assignments to the same value
125 makes the unit file incompatible with parsers for the XDG
126 <filename>.desktop</filename> file format.</para>
127
128 <para>Unit files are loaded from a set of paths determined during
129 compilation, described in the next section.</para>
130
131 <para>Unit files may contain additional options on top of those
132 listed here. If systemd encounters an unknown option, it will
133 write a warning log message but continue loading the unit. If an
134 option or section name is prefixed with <option>X-</option>, it is
135 ignored completely by systemd. Options within an ignored section
136 do not need the prefix. Applications may use this to include
137 additional information in the unit files.</para>
138
139 <para>Boolean arguments used in unit files can be written in
140 various formats. For positive settings the strings
141 <option>1</option>, <option>yes</option>, <option>true</option>
142 and <option>on</option> are equivalent. For negative settings, the
143 strings <option>0</option>, <option>no</option>,
144 <option>false</option> and <option>off</option> are
145 equivalent.</para>
146
bac150e9
ZJS
147 <para>Time span values encoded in unit files can be written in various formats. A stand-alone
148 number specifies a time in seconds. If suffixed with a time unit, the unit is honored. A
149 concatenation of multiple values with units is supported, in which case the values are added
150 up. Example: <literal>50</literal> refers to 50 seconds; <literal>2min 200ms</literal> refers to
151 2 minutes and 200 milliseconds, i.e. 120200 ms. The following time units are understood:
152 <literal>s</literal>, <literal>min</literal>, <literal>h</literal>, <literal>d</literal>,
d923e42e 153 <literal>w</literal>, <literal>ms</literal>, <literal>us</literal>. For details see
798d3a52
ZJS
154 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
155
bac150e9
ZJS
156 <para>Empty lines and lines starting with <literal>#</literal> or <literal>;</literal> are
157 ignored. This may be used for commenting. Lines ending in a backslash are concatenated with the
158 following line while reading and the backslash is replaced by a space character. This may be
159 used to wrap long lines.</para>
160
161 <para>Units can be aliased (have an alternative name), by creating a symlink from the new name
162 to the existing name in one of the unit search paths. For example,
163 <filename>systemd-networkd.service</filename> has the alias
164 <filename>dbus-org.freedesktop.network1.service</filename>, created during installation as the
165 symlink <filename>/usr/lib/systemd/system/dbus-org.freedesktop.network1.service</filename>. In
166 addition, unit files may specify aliases through the <varname>Alias=</varname> directive in the
167 [Install] section; those aliases are only effective when the unit is enabled. When the unit is
168 enabled, symlinks will be created for those names, and removed when the unit is disabled. For
169 example, <filename>reboot.target</filename> specifies
170 <varname>Alias=ctrl-alt-del.target</varname>, so when enabled it will be invoked whenever
171 CTRL+ALT+DEL is pressed. Alias names may be used in commands like <command>enable</command>,
172 <command>disable</command>, <command>start</command>, <command>stop</command>,
173 <command>status</command>, …, and in unit dependency directives <varname>Wants=</varname>,
174 <varname>Requires=</varname>, <varname>Before=</varname>, <varname>After=</varname>, …, with the
175 limitation that aliases specified through <varname>Alias=</varname> are only effective when the
176 unit is enabled. Aliases cannot be used with the <command>preset</command> command.</para>
177
178 <para>Along with a unit file <filename>foo.service</filename>, the directory
179 <filename>foo.service.wants/</filename> may exist. All unit files symlinked from such a
180 directory are implicitly added as dependencies of type <varname>Wants=</varname> to the unit.
181 This is useful to hook units into the start-up of other units, without having to modify their
182 unit files. For details about the semantics of <varname>Wants=</varname>, see below. The
183 preferred way to create symlinks in the <filename>.wants/</filename> directory of a unit file is
184 with the <command>enable</command> command of the
798d3a52 185 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
bac150e9
ZJS
186 tool which reads information from the [Install] section of unit files (see below). A similar
187 functionality exists for <varname>Requires=</varname> type dependencies as well, the directory
188 suffix is <filename>.requires/</filename> in this case.</para>
798d3a52 189
be73bb48 190 <para>Along with a unit file <filename>foo.service</filename>, a "drop-in" directory
bac150e9
ZJS
191 <filename>foo.service.d/</filename> may exist. All files with the suffix
192 <literal>.conf</literal> from this directory will be parsed after the file itself is
193 parsed. This is useful to alter or add configuration settings for a unit, without having to
194 modify unit files. Each drop-in file must have appropriate section headers. Note that for
195 instantiated units, this logic will first look for the instance <literal>.d/</literal>
196 subdirectory and read its <literal>.conf</literal> files, followed by the template
caa45f5b 197 <literal>.d/</literal> subdirectory and the <literal>.conf</literal> files there.</para>
bac150e9
ZJS
198
199 <para>In addition to <filename>/etc/systemd/system</filename>, the drop-in <literal>.d</literal>
200 directories for system services can be placed in <filename>/usr/lib/systemd/system</filename> or
201 <filename>/run/systemd/system</filename> directories. Drop-in files in <filename>/etc</filename>
202 take precedence over those in <filename>/run</filename> which in turn take precedence over those
203 in <filename>/usr/lib</filename>. Drop-in files under any of these directories take precedence
8331eaab
LW
204 over unit files wherever located. Multiple drop-in files with different names are applied in
205 lexicographic order, regardless of which of the directories they reside in.</para>
bac150e9
ZJS
206
207 <!-- Note that we do not document .include here, as we consider it mostly obsolete, and want
208 people to use .d/ drop-ins instead. -->
798d3a52 209
bbe0b4a8
JL
210 <para>Note that while systemd offers a flexible dependency system
211 between units it is recommended to use this functionality only
212 sparingly and instead rely on techniques such as bus-based or
213 socket-based activation which make dependencies implicit,
214 resulting in a both simpler and more flexible system.</para>
215
798d3a52
ZJS
216
217 <para>Optionally, units may be instantiated from a
218 template file at runtime. This allows creation of
219 multiple units from a single configuration file. If
220 systemd looks for a unit configuration file, it will
221 first search for the literal unit name in the
222 file system. If that yields no success and the unit
223 name contains an <literal>@</literal> character, systemd will look for a
224 unit template that shares the same name but with the
225 instance string (i.e. the part between the <literal>@</literal> character
226 and the suffix) removed. Example: if a service
227 <filename>getty@tty3.service</filename> is requested
228 and no file by that name is found, systemd will look
229 for <filename>getty@.service</filename> and
230 instantiate a service from that configuration file if
231 it is found.</para>
232
233 <para>To refer to the instance string from within the
234 configuration file you may use the special <literal>%i</literal>
235 specifier in many of the configuration options. See below for
236 details.</para>
237
238 <para>If a unit file is empty (i.e. has the file size 0) or is
239 symlinked to <filename>/dev/null</filename>, its configuration
240 will not be loaded and it appears with a load state of
241 <literal>masked</literal>, and cannot be activated. Use this as an
242 effective way to fully disable a unit, making it impossible to
243 start it even manually.</para>
244
245 <para>The unit file format is covered by the
246 <ulink
28a0ad81 247 url="https://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise">Interface
798d3a52
ZJS
248 Stability Promise</ulink>.</para>
249
250 </refsect1>
251
2651d037
LP
252 <refsect1>
253 <title>String Escaping for Inclusion in Unit Names</title>
254
255 <para>Sometimes it is useful to convert arbitrary strings into unit names. To facilitate this, a method of string
256 escaping is used, in order to map strings containing arbitrary byte values (except NUL) into valid unit names and
257 their restricted character set. A common special case are unit names that reflect paths to objects in the file
258 system hierarchy. Example: a device unit <filename>dev-sda.device</filename> refers to a device with the device
259 node <filename noindex='true'>/dev/sda</filename> in the file system.</para>
260
261 <para>The escaping algorithm operates as follows: given a string, any <literal>/</literal> character is replaced by
262 <literal>-</literal>, and all other characters which are not ASCII alphanumerics or <literal>_</literal> are
263 replaced by C-style <literal>\x2d</literal> escapes. In addition, <literal>.</literal> is replaced with such a
264 C-style escape when it would appear as the first character in the escaped string.</para>
265
266 <para>When the input qualifies as absolute file system path, this algorithm is extended slightly: the path to the
267 root directory <literal>/</literal> is encoded as single dash <literal>-</literal>. In addition, any leading,
268 trailing or duplicate <literal>/</literal> characters are removed from the string before transformation. Example:
269 <filename>/foo//bar/baz/</filename> becomes <literal>foo-bar-baz</literal>.</para>
270
271 <para>This escaping is fully reversible, as long as it is known whether the escaped string was a path (the
272 unescaping results are different for paths and non-path strings). The
273 <citerefentry><refentrytitle>systemd-escape</refentrytitle><manvolnum>1</manvolnum></citerefentry> command may be
274 used to apply and reverse escaping on arbitrary strings. Use <command>systemd-escape --path</command> to escape
275 path strings, and <command>systemd-escape</command> without <option>--path</option> otherwise.</para>
276 </refsect1>
277
c129bd5d 278 <refsect1>
45f09f93
JL
279 <title>Implicit Dependencies</title>
280
281 <para>A number of unit dependencies are implicitly established,
282 depending on unit type and unit configuration. These implicit
283 dependencies can make unit configuration file cleaner. For the
284 implicit dependencies in each unit type, please refer to
285 section "Implicit Dependencies" in respective man pages.</para>
286
287 <para>For example, service units with <varname>Type=dbus</varname>
288 automatically acquire dependencies of type <varname>Requires=</varname>
289 and <varname>After=</varname> on <filename>dbus.socket</filename>. See
290 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
c129bd5d
LP
291 for details.</para>
292 </refsect1>
293
45f09f93
JL
294 <refsect1>
295 <title>Default Dependencies</title>
296
297 <para>Default dependencies are similar to implicit dependencies,
298 but can be turned on and off by setting
299 <varname>DefaultDependencies=</varname> to <varname>yes</varname>
300 (the default) and <varname>no</varname>, while implicit dependencies
301 are always in effect. See section "Default Dependencies" in respective
302 man pages for the effect of enabling
303 <varname>DefaultDependencies=</varname> in each unit types.</para>
304
305 <para>For example, target units will complement all configured
dcfaecc7 306 dependencies of type <varname>Wants=</varname> or
45f09f93 307 <varname>Requires=</varname> with dependencies of type
c85f1346
YW
308 <varname>After=</varname> unless <varname>DefaultDependencies=no</varname>
309 is set in the specified units. See
45f09f93
JL
310 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>
311 for details. Note that this behavior can be turned off by setting
312 <varname>DefaultDependencies=no</varname>.</para>
313 </refsect1>
314
798d3a52 315 <refsect1>
f757855e 316 <title>Unit File Load Path</title>
798d3a52
ZJS
317
318 <para>Unit files are loaded from a set of paths determined during
319 compilation, described in the two tables below. Unit files found
320 in directories listed earlier override files with the same name in
321 directories lower in the list.</para>
322
aa3e4400
EV
323 <para>When the variable <varname>$SYSTEMD_UNIT_PATH</varname> is set,
324 the contents of this variable overrides the unit load path. If
798d3a52
ZJS
325 <varname>$SYSTEMD_UNIT_PATH</varname> ends with an empty component
326 (<literal>:</literal>), the usual unit load path will be appended
327 to the contents of the variable.</para>
328
329 <table>
330 <title>
331 Load path when running in system mode (<option>--system</option>).
332 </title>
333
334 <tgroup cols='2'>
335 <colspec colname='path' />
336 <colspec colname='expl' />
337 <thead>
338 <row>
339 <entry>Path</entry>
340 <entry>Description</entry>
341 </row>
342 </thead>
343 <tbody>
344 <row>
12b42c76 345 <entry><filename>/etc/systemd/system</filename></entry>
798d3a52
ZJS
346 <entry>Local configuration</entry>
347 </row>
348 <row>
349 <entry><filename>/run/systemd/system</filename></entry>
350 <entry>Runtime units</entry>
351 </row>
352 <row>
12b42c76 353 <entry><filename>/usr/lib/systemd/system</filename></entry>
798d3a52
ZJS
354 <entry>Units of installed packages</entry>
355 </row>
356 </tbody>
357 </tgroup>
358 </table>
359
360 <table>
361 <title>
362 Load path when running in user mode (<option>--user</option>).
363 </title>
364
365 <tgroup cols='2'>
366 <colspec colname='path' />
367 <colspec colname='expl' />
368 <thead>
369 <row>
370 <entry>Path</entry>
371 <entry>Description</entry>
372 </row>
373 </thead>
374 <tbody>
375 <row>
376 <entry><filename>$XDG_CONFIG_HOME/systemd/user</filename></entry>
377 <entry>User configuration (only used when $XDG_CONFIG_HOME is set)</entry>
378 </row>
379 <row>
380 <entry><filename>$HOME/.config/systemd/user</filename></entry>
381 <entry>User configuration (only used when $XDG_CONFIG_HOME is not set)</entry>
382 </row>
383 <row>
12b42c76 384 <entry><filename>/etc/systemd/user</filename></entry>
798d3a52
ZJS
385 <entry>Local configuration</entry>
386 </row>
387 <row>
388 <entry><filename>$XDG_RUNTIME_DIR/systemd/user</filename></entry>
389 <entry>Runtime units (only used when $XDG_RUNTIME_DIR is set)</entry>
390 </row>
391 <row>
392 <entry><filename>/run/systemd/user</filename></entry>
393 <entry>Runtime units</entry>
394 </row>
395 <row>
396 <entry><filename>$XDG_DATA_HOME/systemd/user</filename></entry>
397 <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)</entry>
398 </row>
399 <row>
400 <entry><filename>$HOME/.local/share/systemd/user</filename></entry>
401 <entry>Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)</entry>
402 </row>
403 <row>
12b42c76 404 <entry><filename>/usr/lib/systemd/user</filename></entry>
798d3a52
ZJS
405 <entry>Units of packages that have been installed system-wide</entry>
406 </row>
407 </tbody>
408 </tgroup>
409 </table>
410
411 <para>Additional units might be loaded into systemd ("linked")
412 from directories not on the unit load path. See the
413 <command>link</command> command for
414 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
b1c1a519
ZC
415 Also, some units are dynamically created via a
416 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
798d3a52
ZJS
417 </para>
418 </refsect1>
419
420 <refsect1>
421 <title>[Unit] Section Options</title>
422
a8eaaee7 423 <para>The unit file may include a [Unit] section, which carries
798d3a52
ZJS
424 generic information about the unit that is not dependent on the
425 type of unit:</para>
426
427 <variablelist class='unit-directives'>
428
429 <varlistentry>
430 <term><varname>Description=</varname></term>
431 <listitem><para>A free-form string describing the unit. This
432 is intended for use in UIs to show descriptive information
433 along with the unit name. The description should contain a
434 name that means something to the end user. <literal>Apache2
435 Web Server</literal> is a good example. Bad examples are
436 <literal>high-performance light-weight HTTP server</literal>
437 (too generic) or <literal>Apache2</literal> (too specific and
438 meaningless for people who do not know
439 Apache).</para></listitem>
440 </varlistentry>
441
442 <varlistentry>
443 <term><varname>Documentation=</varname></term>
444 <listitem><para>A space-separated list of URIs referencing
445 documentation for this unit or its configuration. Accepted are
446 only URIs of the types <literal>http://</literal>,
447 <literal>https://</literal>, <literal>file:</literal>,
448 <literal>info:</literal>, <literal>man:</literal>. For more
449 information about the syntax of these URIs, see <citerefentry
450 project='man-pages'><refentrytitle>uri</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
451 The URIs should be listed in order of relevance, starting with
452 the most relevant. It is a good idea to first reference
453 documentation that explains what the unit's purpose is,
454 followed by how it is configured, followed by any other
455 related documentation. This option may be specified more than
456 once, in which case the specified list of URIs is merged. If
457 the empty string is assigned to this option, the list is reset
458 and all prior assignments will have no
459 effect.</para></listitem>
460 </varlistentry>
461
462 <varlistentry>
463 <term><varname>Requires=</varname></term>
464
62d3ca24 465 <listitem><para>Configures requirement dependencies on other units. If this unit gets activated, the units
a195dd8e
JL
466 listed here will be activated as well. If one of the other units fails to activate, and an ordering dependency
467 <varname>After=</varname> on the failing unit is set, this
468 unit will not be started. This option may be specified more than once or multiple space-separated units may be
62d3ca24
LP
469 specified in one option in which case requirement dependencies for all listed names will be created. Note that
470 requirement dependencies do not influence the order in which services are started or stopped. This has to be
471 configured independently with the <varname>After=</varname> or <varname>Before=</varname> options. If a unit
472 <filename>foo.service</filename> requires a unit <filename>bar.service</filename> as configured with
473 <varname>Requires=</varname> and no ordering is configured with <varname>After=</varname> or
474 <varname>Before=</varname>, then both units will be started simultaneously and without any delay between them
475 if <filename>foo.service</filename> is activated. Often, it is a better choice to use <varname>Wants=</varname>
476 instead of <varname>Requires=</varname> in order to achieve a system that is more robust when dealing with
477 failing services.</para>
478
479 <para>Note that this dependency type does not imply that the other unit always has to be in active state when
480 this unit is running. Specifically: failing condition checks (such as <varname>ConditionPathExists=</varname>,
6b5bb2f9 481 <varname>ConditionPathIsSymbolicLink=</varname>, … — see below) do not cause the start job of a unit with a
62d3ca24
LP
482 <varname>Requires=</varname> dependency on it to fail. Also, some unit types may deactivate on their own (for
483 example, a service process may decide to exit cleanly, or a device may be unplugged by the user), which is not
484 propagated to units having a <varname>Requires=</varname> dependency. Use the <varname>BindsTo=</varname>
485 dependency type together with <varname>After=</varname> to ensure that a unit may never be in active state
486 without a specific other unit also in active state (see below).</para>
487
488 <para>Note that dependencies of this type may also be configured outside of the unit configuration file by
489 adding a symlink to a <filename>.requires/</filename> directory accompanying the unit file. For details, see
798d3a52
ZJS
490 above.</para></listitem>
491 </varlistentry>
492
798d3a52
ZJS
493 <varlistentry>
494 <term><varname>Requisite=</varname></term>
798d3a52 495
f32b43bd 496 <listitem><para>Similar to <varname>Requires=</varname>.
798d3a52
ZJS
497 However, if the units listed here are not started already,
498 they will not be started and the transaction will fail
499 immediately. </para></listitem>
500 </varlistentry>
501
502 <varlistentry>
503 <term><varname>Wants=</varname></term>
504
505 <listitem><para>A weaker version of
506 <varname>Requires=</varname>. Units listed in this option will
507 be started if the configuring unit is. However, if the listed
508 units fail to start or cannot be added to the transaction,
509 this has no impact on the validity of the transaction as a
510 whole. This is the recommended way to hook start-up of one
511 unit to the start-up of another unit.</para>
512
513 <para>Note that dependencies of this type may also be
514 configured outside of the unit configuration file by adding
515 symlinks to a <filename>.wants/</filename> directory
516 accompanying the unit file. For details, see
517 above.</para></listitem>
518 </varlistentry>
519
520 <varlistentry>
521 <term><varname>BindsTo=</varname></term>
522
62d3ca24
LP
523 <listitem><para>Configures requirement dependencies, very similar in style to
524 <varname>Requires=</varname>. However, this dependency type is stronger: in addition to the effect of
525 <varname>Requires=</varname> it declares that if the unit bound to is stopped, this unit will be stopped
526 too. This means a unit bound to another unit that suddenly enters inactive state will be stopped too.
527 Units can suddenly, unexpectedly enter inactive state for different reasons: the main process of a service unit
528 might terminate on its own choice, the backing device of a device unit might be unplugged or the mount point of
529 a mount unit might be unmounted without involvement of the system and service manager.</para>
530
531 <para>When used in conjunction with <varname>After=</varname> on the same unit the behaviour of
532 <varname>BindsTo=</varname> is even stronger. In this case, the unit bound to strictly has to be in active
533 state for this unit to also be in active state. This not only means a unit bound to another unit that suddenly
534 enters inactive state, but also one that is bound to another unit that gets skipped due to a failed condition
535 check (such as <varname>ConditionPathExists=</varname>, <varname>ConditionPathIsSymbolicLink=</varname>, … —
536 see below) will be stopped, should it be running. Hence, in many cases it is best to combine
537 <varname>BindsTo=</varname> with <varname>After=</varname>.</para></listitem>
798d3a52
ZJS
538 </varlistentry>
539
540 <varlistentry>
541 <term><varname>PartOf=</varname></term>
542
543 <listitem><para>Configures dependencies similar to
544 <varname>Requires=</varname>, but limited to stopping and
545 restarting of units. When systemd stops or restarts the units
546 listed here, the action is propagated to this unit. Note that
547 this is a one-way dependency — changes to this unit do not
548 affect the listed units. </para></listitem>
549 </varlistentry>
550
551 <varlistentry>
552 <term><varname>Conflicts=</varname></term>
553
554 <listitem><para>A space-separated list of unit names.
555 Configures negative requirement dependencies. If a unit has a
556 <varname>Conflicts=</varname> setting on another unit,
557 starting the former will stop the latter and vice versa. Note
558 that this setting is independent of and orthogonal to the
559 <varname>After=</varname> and <varname>Before=</varname>
560 ordering dependencies.</para>
561
562 <para>If a unit A that conflicts with a unit B is scheduled to
563 be started at the same time as B, the transaction will either
564 fail (in case both are required part of the transaction) or be
565 modified to be fixed (in case one or both jobs are not a
566 required part of the transaction). In the latter case, the job
567 that is not the required will be removed, or in case both are
568 not required, the unit that conflicts will be started and the
569 unit that is conflicted is stopped.</para></listitem>
570 </varlistentry>
571
572 <varlistentry>
573 <term><varname>Before=</varname></term>
574 <term><varname>After=</varname></term>
575
2eb6ff5e
LP
576 <listitem><para>These two settings expect a space-separated list of unit names. They configure ordering
577 dependencies between units. If a unit <filename>foo.service</filename> contains a setting
578 <option>Before=bar.service</option> and both units are being started, <filename>bar.service</filename>'s
579 start-up is delayed until <filename>foo.service</filename> has finished starting up. Note that this setting is
580 independent of and orthogonal to the requirement dependencies as configured by <varname>Requires=</varname>,
581 <varname>Wants=</varname> or <varname>BindsTo=</varname>. It is a common pattern to include a unit name in both
582 the <varname>After=</varname> and <varname>Requires=</varname> options, in which case the unit listed will be
583 started before the unit that is configured with these options. This option may be specified more than once, in
584 which case ordering dependencies for all listed names are created. <varname>After=</varname> is the inverse of
585 <varname>Before=</varname>, i.e. while <varname>After=</varname> ensures that the configured unit is started
586 after the listed unit finished starting up, <varname>Before=</varname> ensures the opposite, that the
587 configured unit is fully started up before the listed unit is started. Note that when two units with an
588 ordering dependency between them are shut down, the inverse of the start-up order is applied. i.e. if a unit is
589 configured with <varname>After=</varname> on another unit, the former is stopped before the latter if both are
590 shut down. Given two units with any ordering dependency between them, if one unit is shut down and the other is
591 started up, the shutdown is ordered before the start-up. It doesn't matter if the ordering dependency is
592 <varname>After=</varname> or <varname>Before=</varname>, in this case. It also doesn't matter which of the two
593 is shut down, as long as one is shut down and the other is started up. The shutdown is ordered before the
594 start-up in all cases. If two units have no ordering dependencies between them, they are shut down or started
595 up simultaneously, and no ordering takes place. It depends on the unit type when precisely a unit has finished
596 starting up. Most importantly, for service units start-up is considered completed for the purpose of
597 <varname>Before=</varname>/<varname>After=</varname> when all its configured start-up commands have been
598 invoked and they either failed or reported start-up success.</para></listitem>
798d3a52
ZJS
599 </varlistentry>
600
601 <varlistentry>
602 <term><varname>OnFailure=</varname></term>
603
604 <listitem><para>A space-separated list of one or more units
605 that are activated when this unit enters the
606 <literal>failed</literal> state.</para></listitem>
607 </varlistentry>
608
609 <varlistentry>
610 <term><varname>PropagatesReloadTo=</varname></term>
611 <term><varname>ReloadPropagatedFrom=</varname></term>
612
613 <listitem><para>A space-separated list of one or more units
614 where reload requests on this unit will be propagated to, or
615 reload requests on the other unit will be propagated to this
616 unit, respectively. Issuing a reload request on a unit will
617 automatically also enqueue a reload request on all units that
618 the reload request shall be propagated to via these two
619 settings.</para></listitem>
620 </varlistentry>
621
622 <varlistentry>
623 <term><varname>JoinsNamespaceOf=</varname></term>
624
625 <listitem><para>For units that start processes (such as
626 service units), lists one or more other units whose network
627 and/or temporary file namespace to join. This only applies to
628 unit types which support the
629 <varname>PrivateNetwork=</varname> and
630 <varname>PrivateTmp=</varname> directives (see
631 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
632 for details). If a unit that has this setting set is started,
633 its processes will see the same <filename>/tmp</filename>,
80f524a4 634 <filename>/var/tmp</filename> and network namespace as one
798d3a52
ZJS
635 listed unit that is started. If multiple listed units are
636 already started, it is not defined which namespace is joined.
637 Note that this setting only has an effect if
638 <varname>PrivateNetwork=</varname> and/or
639 <varname>PrivateTmp=</varname> is enabled for both the unit
640 that joins the namespace and the unit whose namespace is
641 joined.</para></listitem>
642 </varlistentry>
643
644 <varlistentry>
645 <term><varname>RequiresMountsFor=</varname></term>
646
647 <listitem><para>Takes a space-separated list of absolute
648 paths. Automatically adds dependencies of type
649 <varname>Requires=</varname> and <varname>After=</varname> for
650 all mount units required to access the specified path.</para>
651
652 <para>Mount points marked with <option>noauto</option> are not
88e328fd
ZJS
653 mounted automatically through <filename>local-fs.target</filename>,
654 but are still honored for the purposes of this option, i.e. they
655 will be pulled in by this unit.</para></listitem>
798d3a52
ZJS
656 </varlistentry>
657
658 <varlistentry>
659 <term><varname>OnFailureJobMode=</varname></term>
660
661 <listitem><para>Takes a value of
662 <literal>fail</literal>,
663 <literal>replace</literal>,
664 <literal>replace-irreversibly</literal>,
665 <literal>isolate</literal>,
666 <literal>flush</literal>,
667 <literal>ignore-dependencies</literal> or
668 <literal>ignore-requirements</literal>. Defaults to
669 <literal>replace</literal>. Specifies how the units listed in
670 <varname>OnFailure=</varname> will be enqueued. See
671 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
672 <option>--job-mode=</option> option for details on the
673 possible values. If this is set to <literal>isolate</literal>,
674 only a single unit may be listed in
675 <varname>OnFailure=</varname>..</para></listitem>
676 </varlistentry>
677
678 <varlistentry>
679 <term><varname>IgnoreOnIsolate=</varname></term>
680
26adf774
ZJS
681 <listitem><para>Takes a boolean argument. If <option>true</option>, this unit
682 will not be stopped when isolating another unit. Defaults to
683 <option>false</option> for service, target, socket, busname, timer, and path
684 units, and <option>true</option> for slice, scope, device, swap, mount, and
685 automount units.</para></listitem>
798d3a52
ZJS
686 </varlistentry>
687
798d3a52
ZJS
688 <varlistentry>
689 <term><varname>StopWhenUnneeded=</varname></term>
690
691 <listitem><para>Takes a boolean argument. If
692 <option>true</option>, this unit will be stopped when it is no
b938cb90 693 longer used. Note that, in order to minimize the work to be
798d3a52
ZJS
694 executed, systemd will not stop units by default unless they
695 are conflicting with other units, or the user explicitly
696 requested their shut down. If this option is set, a unit will
697 be automatically cleaned up if no other active unit requires
698 it. Defaults to <option>false</option>.</para></listitem>
699 </varlistentry>
700
701 <varlistentry>
702 <term><varname>RefuseManualStart=</varname></term>
703 <term><varname>RefuseManualStop=</varname></term>
704
705 <listitem><para>Takes a boolean argument. If
706 <option>true</option>, this unit can only be activated or
707 deactivated indirectly. In this case, explicit start-up or
708 termination requested by the user is denied, however if it is
709 started or stopped as a dependency of another unit, start-up
710 or termination will succeed. This is mostly a safety feature
711 to ensure that the user does not accidentally activate units
712 that are not intended to be activated explicitly, and not
713 accidentally deactivate units that are not intended to be
714 deactivated. These options default to
715 <option>false</option>.</para></listitem>
716 </varlistentry>
717
718 <varlistentry>
719 <term><varname>AllowIsolate=</varname></term>
720
721 <listitem><para>Takes a boolean argument. If
722 <option>true</option>, this unit may be used with the
723 <command>systemctl isolate</command> command. Otherwise, this
724 will be refused. It probably is a good idea to leave this
725 disabled except for target units that shall be used similar to
726 runlevels in SysV init systems, just as a precaution to avoid
727 unusable system states. This option defaults to
728 <option>false</option>.</para></listitem>
729 </varlistentry>
730
731 <varlistentry>
732 <term><varname>DefaultDependencies=</varname></term>
733
734 <listitem><para>Takes a boolean argument. If
735 <option>true</option>, (the default), a few default
736 dependencies will implicitly be created for the unit. The
737 actual dependencies created depend on the unit type. For
738 example, for service units, these dependencies ensure that the
739 service is started only after basic system initialization is
740 completed and is properly terminated on system shutdown. See
741 the respective man pages for details. Generally, only services
742 involved with early boot or late shutdown should set this
743 option to <option>false</option>. It is highly recommended to
744 leave this option enabled for the majority of common units. If
745 set to <option>false</option>, this option does not disable
746 all implicit dependencies, just non-essential
747 ones.</para></listitem>
748 </varlistentry>
749
750 <varlistentry>
751 <term><varname>JobTimeoutSec=</varname></term>
a2df3ea4 752 <term><varname>JobRunningTimeoutSec=</varname></term>
798d3a52
ZJS
753 <term><varname>JobTimeoutAction=</varname></term>
754 <term><varname>JobTimeoutRebootArgument=</varname></term>
755
a2df3ea4
MK
756 <listitem><para>When a job for this unit is queued, a time-out <varname>JobTimeoutSec=</varname> may be
757 configured. Similarly, <varname>JobRunningTimeoutSec=</varname> starts counting when the queued job is actually
758 started. If either time limit is reached, the job will be cancelled, the unit however will not change state or
759 even enter the <literal>failed</literal> mode. This value defaults to <literal>infinity</literal> (job timeouts
760 disabled), except for device units (<varname>JobRunningTimeoutSec=</varname> defaults to
761 <varname>DefaultTimeoutStartSec=</varname>). NB: this timeout is independent from any unit-specific timeout
762 (for example, the timeout set with <varname>TimeoutStartSec=</varname> in service units) as the job timeout has
763 no effect on the unit itself, only on the job that might be pending for it. Or in other words: unit-specific
764 timeouts are useful to abort unit state changes, and revert them. The job timeout set with this option however
765 is useful to abort only the job waiting for the unit state to change.</para>
798d3a52 766
0aabe747
AJ
767 <para><varname>JobTimeoutAction=</varname> optionally configures an additional action to take when the time-out
768 is hit. It takes the same values as <varname>StartLimitAction=</varname>. Defaults to <option>none</option>.
769 <varname>JobTimeoutRebootArgument=</varname> configures an optional reboot string to pass to the
798d3a52
ZJS
770 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
771 system call.</para></listitem>
772 </varlistentry>
773
6bf0f408 774 <varlistentry>
fc5ffacd
ZJS
775 <term><varname>StartLimitIntervalSec=<replaceable>interval</replaceable></varname></term>
776 <term><varname>StartLimitBurst=<replaceable>burst</replaceable></varname></term>
6bf0f408 777
fc5ffacd
ZJS
778 <listitem><para>Configure unit start rate limiting. Units which are started more than
779 <replaceable>burst</replaceable> times within an <replaceable>interval</replaceable> time interval
780 are not permitted to start any more. Use <varname>StartLimitIntervalSec=</varname> to configure the
f0367da7 781 checking interval (defaults to <varname>DefaultStartLimitIntervalSec=</varname> in manager configuration file,
fc5ffacd 782 set it to 0 to disable any kind of rate limiting). Use <varname>StartLimitBurst=</varname> to configure how many
6bf0f408
LP
783 starts per interval are allowed (defaults to <varname>DefaultStartLimitBurst=</varname> in manager
784 configuration file). These configuration options are particularly useful in conjunction with the service
785 setting <varname>Restart=</varname> (see
786 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>); however,
787 they apply to all kinds of starts (including manual), not just those triggered by the
788 <varname>Restart=</varname> logic. Note that units which are configured for <varname>Restart=</varname> and
789 which reach the start limit are not attempted to be restarted anymore; however, they may still be restarted
fc5ffacd
ZJS
790 manually at a later point, after the <replaceable>interval</replaceable> has passed.
791 From this point on, the restart logic is activated again. Note that
6bf0f408
LP
792 <command>systemctl reset-failed</command> will cause the restart rate counter for a service to be flushed,
793 which is useful if the administrator wants to manually start a unit and the start limit interferes with
7629ec46 794 that. Note that this rate-limiting is enforced after any unit condition checks are executed, and hence unit
fc5ffacd
ZJS
795 activations with failing conditions do not count towards this rate limit. This setting does not apply to
796 slice, target, device, and scope units, since they are unit types whose activation may either never fail, or
797 may succeed only a single time.</para></listitem>
6bf0f408
LP
798 </varlistentry>
799
800 <varlistentry>
801 <term><varname>StartLimitAction=</varname></term>
802
803 <listitem><para>Configure the action to take if the rate limit configured with
f0367da7 804 <varname>StartLimitIntervalSec=</varname> and <varname>StartLimitBurst=</varname> is hit. Takes one of
6bf0f408
LP
805 <option>none</option>, <option>reboot</option>, <option>reboot-force</option>,
806 <option>reboot-immediate</option>, <option>poweroff</option>, <option>poweroff-force</option> or
807 <option>poweroff-immediate</option>. If <option>none</option> is set, hitting the rate limit will trigger no
808 action besides that the start will not be permitted. <option>reboot</option> causes a reboot following the
809 normal shutdown procedure (i.e. equivalent to <command>systemctl reboot</command>).
810 <option>reboot-force</option> causes a forced reboot which will terminate all processes forcibly but should
811 cause no dirty file systems on reboot (i.e. equivalent to <command>systemctl reboot -f</command>) and
812 <option>reboot-immediate</option> causes immediate execution of the
813 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry> system call, which
814 might result in data loss. Similarly, <option>poweroff</option>, <option>poweroff-force</option>,
815 <option>poweroff-immediate</option> have the effect of powering down the system with similar
816 semantics. Defaults to <option>none</option>.</para></listitem>
817 </varlistentry>
818
819 <varlistentry>
820 <term><varname>RebootArgument=</varname></term>
821 <listitem><para>Configure the optional argument for the
822 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry> system call if
823 <varname>StartLimitAction=</varname> or a service's <varname>FailureAction=</varname> is a reboot action. This
824 works just like the optional argument to <command>systemctl reboot</command> command.</para></listitem>
825 </varlistentry>
826
798d3a52
ZJS
827 <varlistentry>
828 <term><varname>ConditionArchitecture=</varname></term>
829 <term><varname>ConditionVirtualization=</varname></term>
830 <term><varname>ConditionHost=</varname></term>
831 <term><varname>ConditionKernelCommandLine=</varname></term>
832 <term><varname>ConditionSecurity=</varname></term>
833 <term><varname>ConditionCapability=</varname></term>
834 <term><varname>ConditionACPower=</varname></term>
835 <term><varname>ConditionNeedsUpdate=</varname></term>
836 <term><varname>ConditionFirstBoot=</varname></term>
837 <term><varname>ConditionPathExists=</varname></term>
838 <term><varname>ConditionPathExistsGlob=</varname></term>
839 <term><varname>ConditionPathIsDirectory=</varname></term>
840 <term><varname>ConditionPathIsSymbolicLink=</varname></term>
841 <term><varname>ConditionPathIsMountPoint=</varname></term>
842 <term><varname>ConditionPathIsReadWrite=</varname></term>
843 <term><varname>ConditionDirectoryNotEmpty=</varname></term>
844 <term><varname>ConditionFileNotEmpty=</varname></term>
845 <term><varname>ConditionFileIsExecutable=</varname></term>
c465a29f
FS
846 <term><varname>ConditionUser=</varname></term>
847 <term><varname>ConditionGroup=</varname></term>
798d3a52 848
7ca41557 849 <!-- We do not document ConditionNull=
b938cb90 850 here, as it is not particularly
798d3a52
ZJS
851 useful and probably just
852 confusing. -->
853
41448597
LP
854 <listitem><para>Before starting a unit, verify that the specified condition is true. If it is not true, the
855 starting of the unit will be (mostly silently) skipped, however all ordering dependencies of it are still
856 respected. A failing condition will not result in the unit being moved into a failure state. The condition is
857 checked at the time the queued start job is to be executed. Use condition expressions in order to silently skip
858 units that do not apply to the local running system, for example because the kernel or runtime environment
859 doesn't require its functionality. Use the various <varname>AssertArchitecture=</varname>,
860 <varname>AssertVirtualization=</varname>, … options for a similar mechanism that puts the unit in a failure
861 state and logs about the failed check (see below).</para>
798d3a52
ZJS
862
863 <para><varname>ConditionArchitecture=</varname> may be used to
864 check whether the system is running on a specific
865 architecture. Takes one of
866 <varname>x86</varname>,
867 <varname>x86-64</varname>,
868 <varname>ppc</varname>,
869 <varname>ppc-le</varname>,
870 <varname>ppc64</varname>,
871 <varname>ppc64-le</varname>,
872 <varname>ia64</varname>,
873 <varname>parisc</varname>,
874 <varname>parisc64</varname>,
875 <varname>s390</varname>,
876 <varname>s390x</varname>,
877 <varname>sparc</varname>,
878 <varname>sparc64</varname>,
879 <varname>mips</varname>,
880 <varname>mips-le</varname>,
881 <varname>mips64</varname>,
882 <varname>mips64-le</varname>,
883 <varname>alpha</varname>,
884 <varname>arm</varname>,
885 <varname>arm-be</varname>,
886 <varname>arm64</varname>,
887 <varname>arm64-be</varname>,
888 <varname>sh</varname>,
889 <varname>sh64</varname>,
215a2db4 890 <varname>m68k</varname>,
798d3a52 891 <varname>tilegx</varname>,
27b09f1f
AB
892 <varname>cris</varname>,
893 <varname>arc</varname>,
894 <varname>arc-be</varname> to test
798d3a52
ZJS
895 against a specific architecture. The architecture is
896 determined from the information returned by
3ba3a79d 897 <citerefentry project='man-pages'><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
898 and is thus subject to
899 <citerefentry><refentrytitle>personality</refentrytitle><manvolnum>2</manvolnum></citerefentry>.
900 Note that a <varname>Personality=</varname> setting in the
901 same unit file has no effect on this condition. A special
902 architecture name <varname>native</varname> is mapped to the
903 architecture the system manager itself is compiled for. The
904 test may be negated by prepending an exclamation mark.</para>
905
906 <para><varname>ConditionVirtualization=</varname> may be used
907 to check whether the system is executed in a virtualized
908 environment and optionally test whether it is a specific
909 implementation. Takes either boolean value to check if being
910 executed in any virtualized environment, or one of
911 <varname>vm</varname> and
912 <varname>container</varname> to test against a generic type of
913 virtualization solution, or one of
914 <varname>qemu</varname>,
915 <varname>kvm</varname>,
916 <varname>zvm</varname>,
917 <varname>vmware</varname>,
918 <varname>microsoft</varname>,
919 <varname>oracle</varname>,
920 <varname>xen</varname>,
921 <varname>bochs</varname>,
922 <varname>uml</varname>,
923 <varname>openvz</varname>,
924 <varname>lxc</varname>,
925 <varname>lxc-libvirt</varname>,
926 <varname>systemd-nspawn</varname>,
9fb16425
ILG
927 <varname>docker</varname>,
928 <varname>rkt</varname> to test
299a34c1
ZJS
929 against a specific implementation, or
930 <varname>private-users</varname> to check whether we are running in a user namespace. See
798d3a52
ZJS
931 <citerefentry><refentrytitle>systemd-detect-virt</refentrytitle><manvolnum>1</manvolnum></citerefentry>
932 for a full list of known virtualization technologies and their
933 identifiers. If multiple virtualization technologies are
934 nested, only the innermost is considered. The test may be
935 negated by prepending an exclamation mark.</para>
936
937 <para><varname>ConditionHost=</varname> may be used to match
938 against the hostname or machine ID of the host. This either
939 takes a hostname string (optionally with shell style globs)
940 which is tested against the locally set hostname as returned
941 by
942 <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
943 or a machine ID formatted as string (see
944 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
945 The test may be negated by prepending an exclamation
946 mark.</para>
947
948 <para><varname>ConditionKernelCommandLine=</varname> may be
949 used to check whether a specific kernel command line option is
950 set (or if prefixed with the exclamation mark unset). The
951 argument must either be a single word, or an assignment (i.e.
952 two words, separated <literal>=</literal>). In the former case
953 the kernel command line is searched for the word appearing as
954 is, or as left hand side of an assignment. In the latter case,
955 the exact assignment is looked for with right and left hand
956 side matching.</para>
957
958 <para><varname>ConditionSecurity=</varname> may be used to
959 check whether the given security module is enabled on the
b8e1d4d1 960 system. Currently, the recognized values are
798d3a52
ZJS
961 <varname>selinux</varname>,
962 <varname>apparmor</varname>,
ed440f6b 963 <varname>tomoyo</varname>,
798d3a52
ZJS
964 <varname>ima</varname>,
965 <varname>smack</varname> and
966 <varname>audit</varname>. The test may be negated by
967 prepending an exclamation mark.</para>
968
969 <para><varname>ConditionCapability=</varname> may be used to
970 check whether the given capability exists in the capability
971 bounding set of the service manager (i.e. this does not check
972 whether capability is actually available in the permitted or
973 effective sets, see
974 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
975 for details). Pass a capability name such as
976 <literal>CAP_MKNOD</literal>, possibly prefixed with an
977 exclamation mark to negate the check.</para>
978
979 <para><varname>ConditionACPower=</varname> may be used to
980 check whether the system has AC power, or is exclusively
981 battery powered at the time of activation of the unit. This
982 takes a boolean argument. If set to <varname>true</varname>,
983 the condition will hold only if at least one AC connector of
984 the system is connected to a power source, or if no AC
985 connectors are known. Conversely, if set to
986 <varname>false</varname>, the condition will hold only if
987 there is at least one AC connector known and all AC connectors
988 are disconnected from a power source.</para>
989
990 <para><varname>ConditionNeedsUpdate=</varname> takes one of
991 <filename>/var</filename> or <filename>/etc</filename> as
992 argument, possibly prefixed with a <literal>!</literal> (for
993 inverting the condition). This condition may be used to
994 conditionalize units on whether the specified directory
995 requires an update because <filename>/usr</filename>'s
996 modification time is newer than the stamp file
997 <filename>.updated</filename> in the specified directory. This
998 is useful to implement offline updates of the vendor operating
999 system resources in <filename>/usr</filename> that require
1000 updating of <filename>/etc</filename> or
1001 <filename>/var</filename> on the next following boot. Units
1002 making use of this condition should order themselves before
1003 <citerefentry><refentrytitle>systemd-update-done.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
7f3fdb7f 1004 to make sure they run before the stamp file's modification
798d3a52
ZJS
1005 time gets reset indicating a completed update.</para>
1006
23254af1
LP
1007 <para><varname>ConditionFirstBoot=</varname> takes a boolean argument. This condition may be used to
1008 conditionalize units on whether the system is booting up with an unpopulated <filename>/etc</filename>
1009 directory (specifically: an <filename>/etc</filename> with no <filename>/etc/machine-id</filename>). This may
1010 be used to populate <filename>/etc</filename> on the first boot after factory reset, or when a new system
1011 instance boots up for the first time.</para>
798d3a52
ZJS
1012
1013 <para>With <varname>ConditionPathExists=</varname> a file
1014 existence condition is checked before a unit is started. If
1015 the specified absolute path name does not exist, the condition
1016 will fail. If the absolute path name passed to
1017 <varname>ConditionPathExists=</varname> is prefixed with an
1018 exclamation mark (<literal>!</literal>), the test is negated,
1019 and the unit is only started if the path does not
1020 exist.</para>
1021
1022 <para><varname>ConditionPathExistsGlob=</varname> is similar
1023 to <varname>ConditionPathExists=</varname>, but checks for the
1024 existence of at least one file or directory matching the
1025 specified globbing pattern.</para>
1026
1027 <para><varname>ConditionPathIsDirectory=</varname> is similar
1028 to <varname>ConditionPathExists=</varname> but verifies
1029 whether a certain path exists and is a directory.</para>
1030
1031 <para><varname>ConditionPathIsSymbolicLink=</varname> is
1032 similar to <varname>ConditionPathExists=</varname> but
1033 verifies whether a certain path exists and is a symbolic
1034 link.</para>
1035
1036 <para><varname>ConditionPathIsMountPoint=</varname> is similar
1037 to <varname>ConditionPathExists=</varname> but verifies
1038 whether a certain path exists and is a mount point.</para>
1039
1040 <para><varname>ConditionPathIsReadWrite=</varname> is similar
1041 to <varname>ConditionPathExists=</varname> but verifies
1042 whether the underlying file system is readable and writable
1043 (i.e. not mounted read-only).</para>
1044
1045 <para><varname>ConditionDirectoryNotEmpty=</varname> is
1046 similar to <varname>ConditionPathExists=</varname> but
1047 verifies whether a certain path exists and is a non-empty
1048 directory.</para>
1049
1050 <para><varname>ConditionFileNotEmpty=</varname> is similar to
1051 <varname>ConditionPathExists=</varname> but verifies whether a
1052 certain path exists and refers to a regular file with a
1053 non-zero size.</para>
1054
1055 <para><varname>ConditionFileIsExecutable=</varname> is similar
1056 to <varname>ConditionPathExists=</varname> but verifies
1057 whether a certain path exists, is a regular file and marked
1058 executable.</para>
1059
c465a29f 1060 <para><varname>ConditionUser=</varname> takes a numeric
534bab66
FS
1061 <literal>UID</literal>, a UNIX user name, or the special value
1062 <literal>@system</literal>. This condition may be used to check
1063 whether the service manager is running as the given user. The
1064 special value <literal>@system</literal> can be used to check
1065 if the user id is within the system user range. This option is not
c465a29f
FS
1066 useful for system services, as the system manager exclusively
1067 runs as the root user, and thus the test result is constant.</para>
1068
1069 <para><varname>ConditionGroup=</varname> is similar
1070 to <varname>ConditionUser=</varname> but verifies that the
1071 service manager's real or effective group, or any of its
534bab66
FS
1072 auxiliary groups match the specified group or GID. This setting
1073 does not have a special value <literal>@system</literal>.</para>
c465a29f 1074
798d3a52
ZJS
1075 <para>If multiple conditions are specified, the unit will be
1076 executed if all of them apply (i.e. a logical AND is applied).
1077 Condition checks can be prefixed with a pipe symbol (|) in
1078 which case a condition becomes a triggering condition. If at
1079 least one triggering condition is defined for a unit, then the
1080 unit will be executed if at least one of the triggering
1081 conditions apply and all of the non-triggering conditions. If
1082 you prefix an argument with the pipe symbol and an exclamation
1083 mark, the pipe symbol must be passed first, the exclamation
1084 second. Except for
1085 <varname>ConditionPathIsSymbolicLink=</varname>, all path
1086 checks follow symlinks. If any of these options is assigned
1087 the empty string, the list of conditions is reset completely,
1088 all previous condition settings (of any kind) will have no
1089 effect.</para></listitem>
1090 </varlistentry>
1091
1092 <varlistentry>
1093 <term><varname>AssertArchitecture=</varname></term>
1094 <term><varname>AssertVirtualization=</varname></term>
1095 <term><varname>AssertHost=</varname></term>
1096 <term><varname>AssertKernelCommandLine=</varname></term>
1097 <term><varname>AssertSecurity=</varname></term>
1098 <term><varname>AssertCapability=</varname></term>
1099 <term><varname>AssertACPower=</varname></term>
1100 <term><varname>AssertNeedsUpdate=</varname></term>
1101 <term><varname>AssertFirstBoot=</varname></term>
1102 <term><varname>AssertPathExists=</varname></term>
1103 <term><varname>AssertPathExistsGlob=</varname></term>
1104 <term><varname>AssertPathIsDirectory=</varname></term>
1105 <term><varname>AssertPathIsSymbolicLink=</varname></term>
1106 <term><varname>AssertPathIsMountPoint=</varname></term>
1107 <term><varname>AssertPathIsReadWrite=</varname></term>
1108 <term><varname>AssertDirectoryNotEmpty=</varname></term>
1109 <term><varname>AssertFileNotEmpty=</varname></term>
1110 <term><varname>AssertFileIsExecutable=</varname></term>
c465a29f
FS
1111 <term><varname>AssertUser=</varname></term>
1112 <term><varname>AssertGroup=</varname></term>
798d3a52 1113
41448597
LP
1114 <listitem><para>Similar to the <varname>ConditionArchitecture=</varname>,
1115 <varname>ConditionVirtualization=</varname>, …, condition settings described above, these settings add
1116 assertion checks to the start-up of the unit. However, unlike the conditions settings, any assertion setting
da25e029
ZJS
1117 that is not met results in failure of the start job (which means this is logged loudly). Use assertion
1118 expressions for units that cannot operate when specific requirements are not met, and when this is something
1119 the administrator or user should look into.</para></listitem>
798d3a52
ZJS
1120 </varlistentry>
1121
1122 <varlistentry>
1123 <term><varname>SourcePath=</varname></term>
1124 <listitem><para>A path to a configuration file this unit has
1125 been generated from. This is primarily useful for
1126 implementation of generator tools that convert configuration
1127 from an external configuration file format into native unit
1128 files. This functionality should not be used in normal
1129 units.</para></listitem>
1130 </varlistentry>
32ee7d33 1131
798d3a52
ZJS
1132 </variablelist>
1133
1134 </refsect1>
1135
1136 <refsect1>
1137 <title>[Install] Section Options</title>
1138
be73bb48
LP
1139 <para>Unit files may include an <literal>[Install]</literal> section, which carries installation information for
1140 the unit. This section is not interpreted by
1141 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> during runtime; it is
1142 used by the <command>enable</command> and <command>disable</command> commands of the
1143 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> tool during
caa45f5b 1144 installation of a unit.</para>
798d3a52
ZJS
1145
1146 <variablelist class='unit-directives'>
1147 <varlistentry>
1148 <term><varname>Alias=</varname></term>
1149
f4bf8d2f 1150 <listitem><para>A space-separated list of additional names this unit shall be installed under. The names listed
1245e413 1151 here must have the same suffix (i.e. type) as the unit filename. This option may be specified more than once,
f4bf8d2f
LP
1152 in which case all listed names are used. At installation time, <command>systemctl enable</command> will create
1153 symlinks from these names to the unit filename. Note that not all unit types support such alias names, and this
1154 setting is not supported for them. Specifically, mount, slice, swap, and automount units do not support
1155 aliasing.</para></listitem>
798d3a52
ZJS
1156 </varlistentry>
1157
1158 <varlistentry>
1159 <term><varname>WantedBy=</varname></term>
1160 <term><varname>RequiredBy=</varname></term>
1161
1162 <listitem><para>This option may be used more than once, or a
1163 space-separated list of unit names may be given. A symbolic
1164 link is created in the <filename>.wants/</filename> or
1165 <filename>.requires/</filename> directory of each of the
1166 listed units when this unit is installed by <command>systemctl
1167 enable</command>. This has the effect that a dependency of
1168 type <varname>Wants=</varname> or <varname>Requires=</varname>
1169 is added from the listed unit to the current unit. The primary
1170 result is that the current unit will be started when the
1171 listed unit is started. See the description of
1172 <varname>Wants=</varname> and <varname>Requires=</varname> in
1173 the [Unit] section for details.</para>
1174
1175 <para><command>WantedBy=foo.service</command> in a service
1176 <filename>bar.service</filename> is mostly equivalent to
1177 <command>Alias=foo.service.wants/bar.service</command> in the
1178 same file. In case of template units, <command>systemctl
1179 enable</command> must be called with an instance name, and
1180 this instance will be added to the
1181 <filename>.wants/</filename> or
1182 <filename>.requires/</filename> list of the listed unit. E.g.
1183 <command>WantedBy=getty.target</command> in a service
1184 <filename>getty@.service</filename> will result in
1185 <command>systemctl enable getty@tty2.service</command>
1186 creating a
1187 <filename>getty.target.wants/getty@tty2.service</filename>
1188 link to <filename>getty@.service</filename>.
1189 </para></listitem>
1190 </varlistentry>
1191
1192 <varlistentry>
1193 <term><varname>Also=</varname></term>
1194
1195 <listitem><para>Additional units to install/deinstall when
1196 this unit is installed/deinstalled. If the user requests
1197 installation/deinstallation of a unit with this option
1198 configured, <command>systemctl enable</command> and
1199 <command>systemctl disable</command> will automatically
1200 install/uninstall units listed in this option as well.</para>
1201
1202 <para>This option may be used more than once, or a
1203 space-separated list of unit names may be
1204 given.</para></listitem>
1205 </varlistentry>
1206
1207 <varlistentry>
1208 <term><varname>DefaultInstance=</varname></term>
1209
1210 <listitem><para>In template unit files, this specifies for
1211 which instance the unit shall be enabled if the template is
1212 enabled without any explicitly set instance. This option has
1213 no effect in non-template unit files. The specified string
1214 must be usable as instance identifier.</para></listitem>
1215 </varlistentry>
1216 </variablelist>
1217
1218 <para>The following specifiers are interpreted in the Install
1219 section: %n, %N, %p, %i, %U, %u, %m, %H, %b, %v. For their meaning
1220 see the next section.
1221 </para>
1222 </refsect1>
1223
1224 <refsect1>
1225 <title>Specifiers</title>
1226
1227 <para>Many settings resolve specifiers which may be used to write
1228 generic unit files referring to runtime or unit parameters that
1229 are replaced when the unit files are loaded. The following
1230 specifiers are understood:</para>
1231
1232 <table>
1233 <title>Specifiers available in unit files</title>
1234 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
1235 <colspec colname="spec" />
1236 <colspec colname="mean" />
1237 <colspec colname="detail" />
1238 <thead>
1239 <row>
1240 <entry>Specifier</entry>
1241 <entry>Meaning</entry>
1242 <entry>Details</entry>
1243 </row>
1244 </thead>
1245 <tbody>
1246 <row>
1247 <entry><literal>%n</literal></entry>
1248 <entry>Full unit name</entry>
1249 <entry></entry>
1250 </row>
1251 <row>
1252 <entry><literal>%N</literal></entry>
1253 <entry>Unescaped full unit name</entry>
2651d037 1254 <entry>Same as <literal>%n</literal>, but with escaping undone. This undoes the escaping used when generating unit names from arbitrary strings (see above). </entry>
798d3a52
ZJS
1255 </row>
1256 <row>
1257 <entry><literal>%p</literal></entry>
1258 <entry>Prefix name</entry>
1259 <entry>For instantiated units, this refers to the string before the <literal>@</literal> character of the unit name. For non-instantiated units, this refers to the name of the unit with the type suffix removed.</entry>
1260 </row>
1261 <row>
1262 <entry><literal>%P</literal></entry>
1263 <entry>Unescaped prefix name</entry>
1264 <entry>Same as <literal>%p</literal>, but with escaping undone</entry>
1265 </row>
1266 <row>
1267 <entry><literal>%i</literal></entry>
1268 <entry>Instance name</entry>
1269 <entry>For instantiated units: this is the string between the <literal>@</literal> character and the suffix of the unit name.</entry>
1270 </row>
1271 <row>
1272 <entry><literal>%I</literal></entry>
1273 <entry>Unescaped instance name</entry>
1274 <entry>Same as <literal>%i</literal>, but with escaping undone</entry>
1275 </row>
1276 <row>
1277 <entry><literal>%f</literal></entry>
1278 <entry>Unescaped filename</entry>
2651d037 1279 <entry>This is either the unescaped instance name (if applicable) with <filename>/</filename> prepended (if applicable), or the unescaped prefix name prepended with <filename>/</filename>. This implements unescaping according to the rules for escaping absolute file system paths discussed above.</entry>
798d3a52
ZJS
1280 </row>
1281 <row>
798d3a52 1282 <entry><literal>%t</literal></entry>
14068e17 1283 <entry>Runtime directory root</entry>
798d3a52
ZJS
1284 <entry>This is either <filename>/run</filename> (for the system manager) or the path <literal>$XDG_RUNTIME_DIR</literal> resolves to (for user managers).</entry>
1285 </row>
1286 <row>
14068e17
LP
1287 <entry><literal>%S</literal></entry>
1288 <entry>State directory root </entry>
1289 <entry>This is either <filename>/var/lib</filename> (for the system manager) or the path <literal>$XDG_CONFIG_HOME</literal> resolves to (for user managers).</entry>
1290 </row>
1291 <row>
1292 <entry><literal>%C</literal></entry>
1293 <entry>Cache directory root </entry>
1294 <entry>This is either <filename>/var/cache</filename> (for the system manager) or the path <literal>$XDG_CACHE_HOME</literal> resolves to (for user managers).</entry>
1295 </row>
1296 <row>
1297 <entry><literal>%L</literal></entry>
1298 <entry>Logs directory root </entry>
1299 <entry>This is either <filename>/var/log</filename> (for the system manager) or the path <literal>$XDG_CONFIG_HOME</literal> resolves to with <filename>/log</filename> appended (for user managers).</entry>
1300 </row>
1301 <row>
798d3a52
ZJS
1302 <entry><literal>%u</literal></entry>
1303 <entry>User name</entry>
79413b67 1304 <entry>This is the name of the user running the service manager instance. In case of the system manager this resolves to <literal>root</literal>.</entry>
798d3a52
ZJS
1305 </row>
1306 <row>
1307 <entry><literal>%U</literal></entry>
1308 <entry>User UID</entry>
79413b67 1309 <entry>This is the numeric UID of the user running the service manager instance. In case of the system manager this resolves to <literal>0</literal>.</entry>
798d3a52
ZJS
1310 </row>
1311 <row>
1312 <entry><literal>%h</literal></entry>
1313 <entry>User home directory</entry>
79413b67 1314 <entry>This is the home directory of the user running the service manager instance. In case of the system manager this resolves to <literal>/root</literal>.</entry>
798d3a52
ZJS
1315 </row>
1316 <row>
1317 <entry><literal>%s</literal></entry>
1318 <entry>User shell</entry>
79413b67 1319 <entry>This is the shell of the user running the service manager instance. In case of the system manager this resolves to <literal>/bin/sh</literal>.</entry>
798d3a52
ZJS
1320 </row>
1321 <row>
1322 <entry><literal>%m</literal></entry>
1323 <entry>Machine ID</entry>
1324 <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>
1325 </row>
1326 <row>
1327 <entry><literal>%b</literal></entry>
1328 <entry>Boot ID</entry>
1329 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
1330 </row>
1331 <row>
1332 <entry><literal>%H</literal></entry>
1333 <entry>Host name</entry>
e5f270f5 1334 <entry>The hostname of the running system at the point in time the unit configuration is loaded.</entry>
798d3a52
ZJS
1335 </row>
1336 <row>
1337 <entry><literal>%v</literal></entry>
1338 <entry>Kernel release</entry>
1339 <entry>Identical to <command>uname -r</command> output</entry>
1340 </row>
1341 <row>
1342 <entry><literal>%%</literal></entry>
1343 <entry>Single percent sign</entry>
1344 <entry>Use <literal>%%</literal> in place of <literal>%</literal> to specify a single percent sign.</entry>
1345 </row>
1346 </tbody>
1347 </tgroup>
1348 </table>
1349
798d3a52
ZJS
1350 </refsect1>
1351
1352 <refsect1>
1353 <title>Examples</title>
1354
1355 <example>
1356 <title>Allowing units to be enabled</title>
1357
1358 <para>The following snippet (highlighted) allows a unit (e.g.
1359 <filename>foo.service</filename>) to be enabled via
1360 <command>systemctl enable</command>:</para>
1361
1362 <programlisting>[Unit]
92b1e225
CS
1363Description=Foo
1364
1365[Service]
1366ExecStart=/usr/sbin/foo-daemon
1367
1368<emphasis>[Install]</emphasis>
1369<emphasis>WantedBy=multi-user.target</emphasis></programlisting>
1370
798d3a52
ZJS
1371 <para>After running <command>systemctl enable</command>, a
1372 symlink
12b42c76 1373 <filename>/etc/systemd/system/multi-user.target.wants/foo.service</filename>
798d3a52
ZJS
1374 linking to the actual unit will be created. It tells systemd to
1375 pull in the unit when starting
1376 <filename>multi-user.target</filename>. The inverse
1377 <command>systemctl disable</command> will remove that symlink
1378 again.</para>
1379 </example>
1380
1381 <example>
1382 <title>Overriding vendor settings</title>
1383
1384 <para>There are two methods of overriding vendor settings in
1385 unit files: copying the unit file from
12b42c76
TG
1386 <filename>/usr/lib/systemd/system</filename> to
1387 <filename>/etc/systemd/system</filename> and modifying the
798d3a52
ZJS
1388 chosen settings. Alternatively, one can create a directory named
1389 <filename><replaceable>unit</replaceable>.d/</filename> within
12b42c76 1390 <filename>/etc/systemd/system</filename> and place a drop-in
798d3a52
ZJS
1391 file <filename><replaceable>name</replaceable>.conf</filename>
1392 there that only changes the specific settings one is interested
1393 in. Note that multiple such drop-in files are read if
8331eaab 1394 present, processed in lexicographic order of their filename.</para>
798d3a52
ZJS
1395
1396 <para>The advantage of the first method is that one easily
1397 overrides the complete unit, the vendor unit is not parsed at
1398 all anymore. It has the disadvantage that improvements to the
1399 unit file by the vendor are not automatically incorporated on
1400 updates.</para>
1401
1402 <para>The advantage of the second method is that one only
1403 overrides the settings one specifically wants, where updates to
1404 the unit by the vendor automatically apply. This has the
1405 disadvantage that some future updates by the vendor might be
1406 incompatible with the local changes.</para>
1407
1408 <para>Note that for drop-in files, if one wants to remove
1409 entries from a setting that is parsed as a list (and is not a
1410 dependency), such as <varname>ConditionPathExists=</varname> (or
1411 e.g. <varname>ExecStart=</varname> in service units), one needs
1412 to first clear the list before re-adding all entries except the
1413 one that is to be removed. See below for an example.</para>
1414
1415 <para>This also applies for user instances of systemd, but with
1416 different locations for the unit files. See the section on unit
1417 load paths for further details.</para>
1418
1419 <para>Suppose there is a vendor-supplied unit
12b42c76 1420 <filename>/usr/lib/systemd/system/httpd.service</filename> with
798d3a52
ZJS
1421 the following contents:</para>
1422
1423 <programlisting>[Unit]
92b1e225
CS
1424Description=Some HTTP server
1425After=remote-fs.target sqldb.service
1426Requires=sqldb.service
1427AssertPathExists=/srv/webserver
1428
1429[Service]
1430Type=notify
1431ExecStart=/usr/sbin/some-fancy-httpd-server
1432Nice=5
1433
1434[Install]
1435WantedBy=multi-user.target</programlisting>
1436
798d3a52
ZJS
1437 <para>Now one wants to change some settings as an administrator:
1438 firstly, in the local setup, <filename>/srv/webserver</filename>
e2acdb6b 1439 might not exist, because the HTTP server is configured to use
798d3a52
ZJS
1440 <filename>/srv/www</filename> instead. Secondly, the local
1441 configuration makes the HTTP server also depend on a memory
1442 cache service, <filename>memcached.service</filename>, that
1443 should be pulled in (<varname>Requires=</varname>) and also be
1444 ordered appropriately (<varname>After=</varname>). Thirdly, in
1445 order to harden the service a bit more, the administrator would
1446 like to set the <varname>PrivateTmp=</varname> setting (see
912f003f 1447 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
1448 for details). And lastly, the administrator would like to reset
1449 the niceness of the service to its default value of 0.</para>
1450
1451 <para>The first possibility is to copy the unit file to
12b42c76 1452 <filename>/etc/systemd/system/httpd.service</filename> and
798d3a52
ZJS
1453 change the chosen settings:</para>
1454
1455 <programlisting>[Unit]
92b1e225
CS
1456Description=Some HTTP server
1457After=remote-fs.target sqldb.service <emphasis>memcached.service</emphasis>
1458Requires=sqldb.service <emphasis>memcached.service</emphasis>
1459AssertPathExists=<emphasis>/srv/www</emphasis>
1460
1461[Service]
1462Type=notify
1463ExecStart=/usr/sbin/some-fancy-httpd-server
1464<emphasis>Nice=0</emphasis>
1465<emphasis>PrivateTmp=yes</emphasis>
1466
1467[Install]
1468WantedBy=multi-user.target</programlisting>
1469
798d3a52
ZJS
1470 <para>Alternatively, the administrator could create a drop-in
1471 file
12b42c76 1472 <filename>/etc/systemd/system/httpd.service.d/local.conf</filename>
798d3a52 1473 with the following contents:</para>
92b1e225 1474
798d3a52 1475 <programlisting>[Unit]
92b1e225
CS
1476After=memcached.service
1477Requires=memcached.service
1478# Reset all assertions and then re-add the condition we want
1479AssertPathExists=
1480AssertPathExists=/srv/www
1481
1482[Service]
1483Nice=0
1484PrivateTmp=yes</programlisting>
1485
798d3a52
ZJS
1486 <para>Note that dependencies (<varname>After=</varname>, etc.)
1487 cannot be reset to an empty list, so dependencies can only be
1488 added in drop-ins. If you want to remove dependencies, you have
1489 to override the entire unit.</para>
0cf4c0d1 1490
798d3a52
ZJS
1491 </example>
1492 </refsect1>
1493
1494 <refsect1>
1495 <title>See Also</title>
1496 <para>
1497 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1498 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1499 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1500 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1501 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1502 <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1503 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1504 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1505 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1506 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1507 <citerefentry><refentrytitle>systemd.path</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1508 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
798d3a52
ZJS
1509 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1510 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1511 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1512 <citerefentry><refentrytitle>systemd-analyze</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1513 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1514 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
3ba3a79d 1515 <citerefentry project='man-pages'><refentrytitle>uname</refentrytitle><manvolnum>1</manvolnum></citerefentry>
798d3a52
ZJS
1516 </para>
1517 </refsect1>
d1ab0ca0
LP
1518
1519</refentry>