1SYSTEMD.TARGET(5) systemd.target SYSTEMD.TARGET(5)
2
3
4
6 systemd.target - Target unit configuration
7
9 target.target
10
12 A unit configuration file whose name ends in ".target" encodes
13 information about a target unit of systemd. Target units are used to
14 group units and to set synchronization points for ordering dependencies
15 with other unit files.
16
17 This unit type has no specific options. See systemd.unit(5) for the
18 common options of all unit configuration files. The common
19 configuration items are configured in the generic [Unit] and [Install]
20 sections. A separate [Target] section does not exist, since no
21 target-specific options may be configured.
22
23 Target units do not offer any additional functionality on top of the
24 generic functionality provided by units. They merely group units,
25 allowing a single target name to be used in Wants= and Requires=
26 settings to establish a dependency on a set of units defined by the
27 target, and in Before= and After= settings to establish ordering.
28 Targets establish standardized names for synchronization points during
29 boot and shutdown. Importantly, see systemd.special(7) for examples and
30 descriptions of standard systemd targets.
31
32 Target units provide a more flexible replacement for SysV runlevels in
33 the classic SysV init system. For compatibility reasons special target
34 units such as runlevel3.target exist which are used by the SysV
35 runlevel compatibility code in systemd, see systemd.special(7) for
36 details.
37
38 Note that a target unit file must not be empty, lest it be considered a
39 masked unit. It is recommended to provide a [Unit] section which
40 includes informative Description= and Documentation= options.
41
43 Implicit Dependencies
44 There are no implicit dependencies for target units.
45
46 Default Dependencies
47 The following dependencies are added unless DefaultDependencies=no is
48 set:
49
50 • Target units will automatically complement all configured
51 dependencies of type Wants= or Requires= with dependencies of type
52 After= unless DefaultDependencies=no is set in the specified units.
53
54 Note that the reverse is not true. For example, defining
55 Wants=that.target in some.service will not automatically add the
56 After=that.target ordering dependency for some.service. Instead,
57 some.service should use the primary synchronization function of
58 target type units, by setting a specific After=that.target or
59 Before=that.target ordering dependency in its .service unit file.
60
61 • Target units automatically gain Conflicts= and Before= dependencies
62 against shutdown.target.
63
65 Target unit files may include [Unit] and [Install] sections, which are
66 described in systemd.unit(5). No options specific to this file type are
67 supported.
68
70 Example 1. Simple standalone target
71
72 # emergency-net.target
73
74 [Unit]
75 Description=Emergency Mode with Networking
76 Requires=emergency.target systemd-networkd.service
77 After=emergency.target systemd-networkd.service
78 AllowIsolate=yes
79
80 When adding dependencies to other units, it's important to check if
81 they set DefaultDependencies=. Service units, unless they set
82 DefaultDependencies=no, automatically get a dependency on
83 sysinit.target. In this case, both emergency.target and
84 systemd-networkd.service have DefaultDependencies=no, so they are
85 suitable for use in this target, and do not pull in sysinit.target.
86
87 You can now switch into this emergency mode by running systemctl
88 isolate emergency-net.target or by passing the option
89 systemd.unit=emergency-net.target on the kernel command line.
90
91 Other units can have WantedBy=emergency-net.target in the [Install]
92 section. After they are enabled using systemctl enable, they will be
93 started before emergency-net.target is started. It is also possible to
94 add arbitrary units as dependencies of emergency.target without
95 modifying them by using systemctl add-wants.
96
98 systemd(1), systemctl(1), systemd.unit(5), systemd.special(7),
99 systemd.directives(7)
100
101
102
103systemd 254 SYSTEMD.TARGET(5)