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