]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.target.xml
hwdb: Add mapping for Xiaomi Mipad 2 bottom bezel capacitive buttons
[thirdparty/systemd.git] / man / systemd.target.xml
CommitLineData
da49e9ab 1<?xml version='1.0'?> <!--*-nxml-*-->
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
eea10b26 3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
da49e9ab
LP
5
6<refentry id="systemd.target">
798d3a52
ZJS
7 <refentryinfo>
8 <title>systemd.target</title>
9 <productname>systemd</productname>
798d3a52
ZJS
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>systemd.target</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>systemd.target</refname>
19 <refpurpose>Target unit configuration</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <para><filename><replaceable>target</replaceable>.target</filename></para>
24 </refsynopsisdiv>
25
26 <refsect1>
27 <title>Description</title>
28
e52f9295
ZJS
29 <para>A unit configuration file whose name ends in <literal>.target</literal> encodes information about a
30 target unit of systemd. Target units are used to group units and to set synchronization points for
31 ordering dependencies with other unit files.</para>
798d3a52
ZJS
32
33 <para>This unit type has no specific options. See
e52f9295
ZJS
34 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for the
35 common options of all unit configuration files. The common configuration items are configured in the
36 generic [Unit] and [Install] sections. A separate [Target] section does not exist, since no
37 target-specific options may be configured.</para>
38
39 <para>Target units do not offer any additional functionality on top of the generic functionality provided
40 by units. They merely group units, allowing a single target name to be used in <varname>Wants=</varname>
41 and <varname>Requires=</varname> settings to establish a dependency on a set of units defined by the
42 target, and in <varname>Before=</varname> and <varname>After=</varname> settings to establish ordering.
43 Targets establish standardized names for synchronization points during boot and shutdown. Importantly,
44 see <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
45 for examples and descriptions of standard systemd targets.</para>
46
47 <para>Target units provide a more flexible replacement for SysV runlevels in the classic SysV init
48 system. For compatibility reasons special target units such as <filename>runlevel3.target</filename>
49 exist which are used by the SysV runlevel compatibility code in systemd, see
50 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
51 details.</para>
52
53 <para>Note that a target unit file must not be empty, lest it be considered a masked unit. It is
54 recommended to provide a [Unit] section which includes informative <varname>Description=</varname> and
55 <varname>Documentation=</varname> options.</para>
c129bd5d
LP
56 </refsect1>
57
58 <refsect1>
aed5cb03
ZJS
59 <title>Automatic Dependencies</title>
60
61 <refsect2>
62 <title>Implicit Dependencies</title>
63
64 <para>There are no implicit dependencies for target units.</para>
65 </refsect2>
66
67 <refsect2>
68 <title>Default Dependencies</title>
69
70 <para>The following dependencies are added unless
71 <varname>DefaultDependencies=no</varname> is set:</para>
72
73 <itemizedlist>
e52f9295
ZJS
74 <listitem><para>Target units will automatically complement all configured dependencies of type
75 <varname>Wants=</varname> or <varname>Requires=</varname> with dependencies of type
76 <varname>After=</varname> unless <varname>DefaultDependencies=no</varname> is set in the specified
77 units.</para>
78
79 <para>Note that the reverse is not true. For example, defining <option>Wants=that.target</option> in
80 <filename index='false'>some.service</filename> will not automatically add the
81 <option>After=that.target</option> ordering dependency for <filename>some.service</filename>.
82 Instead, <filename>some.service</filename> should use the primary synchronization function of target
83 type units, by setting a specific <option>After=that.target</option> or
84 <option>Before=that.target</option> ordering dependency in its .service unit file.
85 </para></listitem>
aed5cb03
ZJS
86
87 <listitem><para>Target units automatically gain <varname>Conflicts=</varname>
0029e6b1
MS
88 and <varname>Before=</varname> dependencies against
89 <filename>shutdown.target</filename>.</para></listitem>
aed5cb03
ZJS
90 </itemizedlist>
91 </refsect2>
798d3a52
ZJS
92 </refsect1>
93
d8e1613e
ZJS
94 <refsect1>
95 <title>Options</title>
96
97 <para>Target unit files may include [Unit] and [Install] sections, which are described in
98 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
99 No options specific to this file type are supported.</para>
100 </refsect1>
101
259d1af8
JH
102 <refsect1>
103 <title>Example</title>
104
105 <example>
106 <title>Simple standalone target</title>
107
108 <programlisting># emergency-net.target
109
110[Unit]
111Description=Emergency Mode with Networking
112Requires=emergency.target systemd-networkd.service
113After=emergency.target systemd-networkd.service
114AllowIsolate=yes</programlisting>
115
116 <para>When adding dependencies to other units, it's important to check if they set
117 <varname>DefaultDependencies=</varname>. Service units, unless they set
118 <varname>DefaultDependencies=no</varname>, automatically get a dependency on
119 <filename>sysinit.target</filename>. In this case, both
120 <filename>emergency.target</filename> and <filename>systemd-networkd.service</filename>
121 have <varname>DefaultDependencies=no</varname>, so they are suitable for use
122 in this target, and do not pull in <filename>sysinit.target</filename>.</para>
123
124 <para>You can now switch into this emergency mode by running <varname>systemctl
125 isolate emergency-net.target</varname> or by passing the option
126 <varname>systemd.unit=emergency-net.target</varname> on the kernel command
127 line.</para>
128
129 <para>Other units can have <varname>WantedBy=emergency-net.target</varname> in the
130 <varname>[Install]</varname> section. After they are enabled using
131 <command>systemctl enable</command>, they will be started before
132 <varname>emergency-net.target</varname> is started. It is also possible to add
133 arbitrary units as dependencies of <filename>emergency.target</filename> without
134 modifying them by using <command>systemctl add-wants</command>.
135 </para>
136 </example>
137 </refsect1>
138
798d3a52
ZJS
139 <refsect1>
140 <title>See Also</title>
13a69c12
DT
141 <para><simplelist type="inline">
142 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
143 <member><citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
144 <member><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
145 <member><citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
146 <member><citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
147 </simplelist></para>
798d3a52 148 </refsect1>
da49e9ab
LP
149
150</refentry>