Debian Codegraph @

upstream/debian-trixie/man5/systemd.target.5

raw
1 '\" t
2 .TH "SYSTEMD\&.TARGET" "5" "" "systemd 257.13" "systemd.target"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.target \- Target unit configuration
24 .SH "SYNOPSIS"
25 .PP
26 \fItarget\fR\&.target
27 .SH "DESCRIPTION"
28 .PP
29 A unit configuration file whose name ends in
30 "\&.target"
31 encodes information about a target unit of systemd\&. Target units are used to group units and to set synchronization points for ordering dependencies with other unit files\&.
32 .PP
33 This unit type has no specific options\&. See
34 \fBsystemd.unit\fR(5)
35 for the common options of all unit configuration files\&. The common configuration items are configured in the generic [Unit] and [Install] sections\&. A separate [Target] section does not exist, since no target\-specific options may be configured\&.
36 .PP
37 Target units do not offer any additional functionality on top of the generic functionality provided by units\&. They merely group units, allowing a single target name to be used in
38 \fIWants=\fR
39 and
40 \fIRequires=\fR
41 settings to establish a dependency on a set of units defined by the target, and in
42 \fIBefore=\fR
43 and
44 \fIAfter=\fR
45 settings to establish ordering\&. Targets establish standardized names for synchronization points during boot and shutdown\&. Importantly, see
46 \fBsystemd.special\fR(7)
47 for examples and descriptions of standard systemd targets\&.
48 .PP
49 Target units provide a more flexible replacement for SysV runlevels in the classic SysV init system\&. For compatibility reasons special target units such as
50 runlevel3\&.target
51 exist which are used by the SysV runlevel compatibility code in systemd, see
52 \fBsystemd.special\fR(7)
53 for details\&.
54 .PP
55 Note that a target unit file must not be empty, lest it be considered a masked unit\&. It is recommended to provide a [Unit] section which includes informative
56 \fIDescription=\fR
57 and
58 \fIDocumentation=\fR
59 options\&.
60 .SH "AUTOMATIC DEPENDENCIES"
61 .SS "Implicit Dependencies"
62 .PP
63 There are no implicit dependencies for target units\&.
64 .SS "Default Dependencies"
65 .PP
66 The following dependencies are added unless
67 \fIDefaultDependencies=no\fR
68 is set:
69 .sp
70 .RS 4
71 .ie n \{\
72 \h'-04'\(bu\h'+03'\c
73 .\}
74 .el \{\
75 .sp -1
76 .IP \(bu 2.3
77 .\}
78 Target units will automatically complement all configured dependencies of type
79 \fIWants=\fR
80 or
81 \fIRequires=\fR
82 with dependencies of type
83 \fIAfter=\fR
84 unless
85 \fIDefaultDependencies=no\fR
86 is set in the specified units\&.
87 .sp
88 Note that the reverse is not true\&. For example, defining
89 \fBWants=that\&.target\fR
90 in
91 some\&.service
92 will not automatically add the
93 \fBAfter=that\&.target\fR
94 ordering dependency for
95 some\&.service\&. Instead,
96 some\&.service
97 should use the primary synchronization function of target type units, by setting a specific
98 \fBAfter=that\&.target\fR
99 or
100 \fBBefore=that\&.target\fR
101 ordering dependency in its \&.service unit file\&.
102 .RE
103 .sp
104 .RS 4
105 .ie n \{\
106 \h'-04'\(bu\h'+03'\c
107 .\}
108 .el \{\
109 .sp -1
110 .IP \(bu 2.3
111 .\}
112 Target units automatically gain
113 \fIConflicts=\fR
114 and
115 \fIBefore=\fR
116 dependencies against
117 shutdown\&.target\&.
118 .RE
119 .SH "OPTIONS"
120 .PP
121 Target unit files may include [Unit] and [Install] sections, which are described in
122 \fBsystemd.unit\fR(5)\&. No options specific to this file type are supported\&.
123 .SH "EXAMPLE"
124 .PP
125 \fBExample\ \&1.\ \&Simple standalone target\fR
126 .sp
127 .if n \{\
128 .RS 4
129 .\}
130 .nf
131 # emergency\-net\&.target
132
133 [Unit]
134 Description=Emergency Mode with Networking
135 Requires=emergency\&.target systemd\-networkd\&.service
136 After=emergency\&.target systemd\-networkd\&.service
137 AllowIsolate=yes
138 .fi
139 .if n \{\
140 .RE
141 .\}
142 .PP
143 When adding dependencies to other units, it is important to check if they set
144 \fIDefaultDependencies=\fR\&. Service units, unless they set
145 \fIDefaultDependencies=no\fR, automatically get a dependency on
146 sysinit\&.target\&. In this case, both
147 emergency\&.target
148 and
149 systemd\-networkd\&.service
150 have
151 \fIDefaultDependencies=no\fR, so they are suitable for use in this target, and do not pull in
152 sysinit\&.target\&.
153 .PP
154 You can now switch into this emergency mode by running
155 \fIsystemctl isolate emergency\-net\&.target\fR
156 or by passing the option
157 \fIsystemd\&.unit=emergency\-net\&.target\fR
158 on the kernel command line\&.
159 .PP
160 Other units can have
161 \fIWantedBy=emergency\-net\&.target\fR
162 in the
163 \fI[Install]\fR
164 section\&. After they are enabled using
165 \fBsystemctl enable\fR, they will be started before
166 \fIemergency\-net\&.target\fR
167 is started\&. It is also possible to add arbitrary units as dependencies of
168 emergency\&.target
169 without modifying them by using
170 \fBsystemctl add\-wants\fR\&.
171 .SH "SEE ALSO"
172 .PP
173 \fBsystemd\fR(1), \fBsystemctl\fR(1), \fBsystemd.unit\fR(5), \fBsystemd.special\fR(7), \fBsystemd.directives\fR(7)