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