summaryrefslogtreecommitdiffstats
path: root/upstream/debian-bookworm/man5/systemd.target.5
blob: aa14436a01f9cf6b9031636c6587d1837a9029cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
'\" t
.TH "SYSTEMD\&.TARGET" "5" "" "systemd 254" "systemd.target"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd.target \- Target unit configuration
.SH "SYNOPSIS"
.PP
\fItarget\fR\&.target
.SH "DESCRIPTION"
.PP
A unit configuration file whose name ends in
"\&.target"
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\&.
.PP
This unit type has no specific options\&. See
\fBsystemd.unit\fR(5)
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\&.
.PP
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
\fIWants=\fR
and
\fIRequires=\fR
settings to establish a dependency on a set of units defined by the target, and in
\fIBefore=\fR
and
\fIAfter=\fR
settings to establish ordering\&. Targets establish standardized names for synchronization points during boot and shutdown\&. Importantly, see
\fBsystemd.special\fR(7)
for examples and descriptions of standard systemd targets\&.
.PP
Target units provide a more flexible replacement for SysV runlevels in the classic SysV init system\&. For compatibility reasons special target units such as
runlevel3\&.target
exist which are used by the SysV runlevel compatibility code in systemd, see
\fBsystemd.special\fR(7)
for details\&.
.PP
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
\fIDescription=\fR
and
\fIDocumentation=\fR
options\&.
.SH "AUTOMATIC DEPENDENCIES"
.SS "Implicit Dependencies"
.PP
There are no implicit dependencies for target units\&.
.SS "Default Dependencies"
.PP
The following dependencies are added unless
\fIDefaultDependencies=no\fR
is set:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Target units will automatically complement all configured dependencies of type
\fIWants=\fR
or
\fIRequires=\fR
with dependencies of type
\fIAfter=\fR
unless
\fIDefaultDependencies=no\fR
is set in the specified units\&.
.sp
Note that the reverse is not true\&. For example, defining
\fBWants=that\&.target\fR
in
some\&.service
will not automatically add the
\fBAfter=that\&.target\fR
ordering dependency for
some\&.service\&. Instead,
some\&.service
should use the primary synchronization function of target type units, by setting a specific
\fBAfter=that\&.target\fR
or
\fBBefore=that\&.target\fR
ordering dependency in its \&.service unit file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Target units automatically gain
\fIConflicts=\fR
and
\fIBefore=\fR
dependencies against
shutdown\&.target\&.
.RE
.SH "OPTIONS"
.PP
Target unit files may include [Unit] and [Install] sections, which are described in
\fBsystemd.unit\fR(5)\&. No options specific to this file type are supported\&.
.SH "EXAMPLE"
.PP
\fBExample\ \&1.\ \&Simple standalone target\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# emergency\-net\&.target

[Unit]
Description=Emergency Mode with Networking
Requires=emergency\&.target systemd\-networkd\&.service
After=emergency\&.target systemd\-networkd\&.service
AllowIsolate=yes
.fi
.if n \{\
.RE
.\}
.PP
When adding dependencies to other units, it\*(Aqs important to check if they set
\fIDefaultDependencies=\fR\&. Service units, unless they set
\fIDefaultDependencies=no\fR, automatically get a dependency on
sysinit\&.target\&. In this case, both
emergency\&.target
and
systemd\-networkd\&.service
have
\fIDefaultDependencies=no\fR, so they are suitable for use in this target, and do not pull in
sysinit\&.target\&.
.PP
You can now switch into this emergency mode by running
\fIsystemctl isolate emergency\-net\&.target\fR
or by passing the option
\fIsystemd\&.unit=emergency\-net\&.target\fR
on the kernel command line\&.
.PP
Other units can have
\fIWantedBy=emergency\-net\&.target\fR
in the
\fI[Install]\fR
section\&. After they are enabled using
\fBsystemctl enable\fR, they will be started before
\fIemergency\-net\&.target\fR
is started\&. It is also possible to add arbitrary units as dependencies of
emergency\&.target
without modifying them by using
\fBsystemctl add\-wants\fR\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemctl\fR(1),
\fBsystemd.unit\fR(5),
\fBsystemd.special\fR(7),
\fBsystemd.directives\fR(7)