]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.target.xml
tree-wide: remove Lennart's copyright lines
[thirdparty/systemd.git] / man / systemd.target.xml
CommitLineData
da49e9ab 1<?xml version='1.0'?> <!--*-nxml-*-->
da49e9ab 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
da49e9ab
LP
4
5<!--
572eb058 6 SPDX-License-Identifier: LGPL-2.1+
da49e9ab
LP
7-->
8
9<refentry id="systemd.target">
798d3a52
ZJS
10 <refentryinfo>
11 <title>systemd.target</title>
12 <productname>systemd</productname>
13
14 <authorgroup>
15 <author>
16 <contrib>Developer</contrib>
17 <firstname>Lennart</firstname>
18 <surname>Poettering</surname>
19 <email>lennart@poettering.net</email>
20 </author>
21 </authorgroup>
22 </refentryinfo>
23
24 <refmeta>
25 <refentrytitle>systemd.target</refentrytitle>
26 <manvolnum>5</manvolnum>
27 </refmeta>
28
29 <refnamediv>
30 <refname>systemd.target</refname>
31 <refpurpose>Target unit configuration</refpurpose>
32 </refnamediv>
33
34 <refsynopsisdiv>
35 <para><filename><replaceable>target</replaceable>.target</filename></para>
36 </refsynopsisdiv>
37
38 <refsect1>
39 <title>Description</title>
40
41 <para>A unit configuration file whose name ends in
42 <literal>.target</literal> encodes information about a target unit
43 of systemd, which is used for grouping units and as well-known
44 synchronization points during start-up.</para>
45
46 <para>This unit type has no specific options. See
47 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
48 for the common options of all unit configuration files. The common
49 configuration items are configured in the generic [Unit] and
50 [Install] sections. A separate [Target] section does not exist,
51 since no target-specific options may be configured.</para>
52
53 <para>Target units do not offer any additional functionality on
54 top of the generic functionality provided by units. They exist
55 merely to group units via dependencies (useful as boot targets),
56 and to establish standardized names for synchronization points
57 used in dependencies between units. Among other things, target
58 units are a more flexible replacement for SysV runlevels in the
59 classic SysV init system. (And for compatibility reasons special
60 target units such as <filename>runlevel3.target</filename> exist
61 which are used by the SysV runlevel compatibility code in systemd.
62 See
63 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
64 for details).</para>
c129bd5d
LP
65 </refsect1>
66
67 <refsect1>
aed5cb03
ZJS
68 <title>Automatic Dependencies</title>
69
70 <refsect2>
71 <title>Implicit Dependencies</title>
72
73 <para>There are no implicit dependencies for target units.</para>
74 </refsect2>
75
76 <refsect2>
77 <title>Default Dependencies</title>
78
79 <para>The following dependencies are added unless
80 <varname>DefaultDependencies=no</varname> is set:</para>
81
82 <itemizedlist>
83 <listitem><para>Target units will automatically complement all
84 configured dependencies of type <varname>Wants=</varname> or
85 <varname>Requires=</varname> with dependencies of type
86 <varname>After=</varname> unless <varname>DefaultDependencies=no</varname>
87 is set in the specified units. Note that <varname>Wants=</varname> or
88 <varname>Requires=</varname> must be defined in the target unit itself — if
89 you for example define <varname>Wants=</varname>some.target in
90 some.service, the automatic ordering will not be added.</para></listitem>
91
92 <listitem><para>Target units automatically gain <varname>Conflicts=</varname>
93 dependency against <filename>shutdown.target</filename>.</para></listitem>
94 </itemizedlist>
95 </refsect2>
798d3a52
ZJS
96 </refsect1>
97
259d1af8
JH
98 <refsect1>
99 <title>Example</title>
100
101 <example>
102 <title>Simple standalone target</title>
103
104 <programlisting># emergency-net.target
105
106[Unit]
107Description=Emergency Mode with Networking
108Requires=emergency.target systemd-networkd.service
109After=emergency.target systemd-networkd.service
110AllowIsolate=yes</programlisting>
111
112 <para>When adding dependencies to other units, it's important to check if they set
113 <varname>DefaultDependencies=</varname>. Service units, unless they set
114 <varname>DefaultDependencies=no</varname>, automatically get a dependency on
115 <filename>sysinit.target</filename>. In this case, both
116 <filename>emergency.target</filename> and <filename>systemd-networkd.service</filename>
117 have <varname>DefaultDependencies=no</varname>, so they are suitable for use
118 in this target, and do not pull in <filename>sysinit.target</filename>.</para>
119
120 <para>You can now switch into this emergency mode by running <varname>systemctl
121 isolate emergency-net.target</varname> or by passing the option
122 <varname>systemd.unit=emergency-net.target</varname> on the kernel command
123 line.</para>
124
125 <para>Other units can have <varname>WantedBy=emergency-net.target</varname> in the
126 <varname>[Install]</varname> section. After they are enabled using
127 <command>systemctl enable</command>, they will be started before
128 <varname>emergency-net.target</varname> is started. It is also possible to add
129 arbitrary units as dependencies of <filename>emergency.target</filename> without
130 modifying them by using <command>systemctl add-wants</command>.
131 </para>
132 </example>
133 </refsect1>
134
798d3a52
ZJS
135 <refsect1>
136 <title>See Also</title>
137 <para>
138 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
140 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
141 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
142 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
143 </para>
144 </refsect1>
da49e9ab
LP
145
146</refentry>