]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.target.xml
final v236 update (#7649)
[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
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
da49e9ab
LP
8 This file is part of systemd.
9
10 Copyright 2010 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
da49e9ab
LP
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 20 Lesser General Public License for more details.
da49e9ab 21
5430f7f2 22 You should have received a copy of the GNU Lesser General Public License
da49e9ab
LP
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24-->
25
26<refentry id="systemd.target">
798d3a52
ZJS
27 <refentryinfo>
28 <title>systemd.target</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>systemd.target</refentrytitle>
43 <manvolnum>5</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>systemd.target</refname>
48 <refpurpose>Target unit configuration</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <para><filename><replaceable>target</replaceable>.target</filename></para>
53 </refsynopsisdiv>
54
55 <refsect1>
56 <title>Description</title>
57
58 <para>A unit configuration file whose name ends in
59 <literal>.target</literal> encodes information about a target unit
60 of systemd, which is used for grouping units and as well-known
61 synchronization points during start-up.</para>
62
63 <para>This unit type has no specific options. See
64 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
65 for the common options of all unit configuration files. The common
66 configuration items are configured in the generic [Unit] and
67 [Install] sections. A separate [Target] section does not exist,
68 since no target-specific options may be configured.</para>
69
70 <para>Target units do not offer any additional functionality on
71 top of the generic functionality provided by units. They exist
72 merely to group units via dependencies (useful as boot targets),
73 and to establish standardized names for synchronization points
74 used in dependencies between units. Among other things, target
75 units are a more flexible replacement for SysV runlevels in the
76 classic SysV init system. (And for compatibility reasons special
77 target units such as <filename>runlevel3.target</filename> exist
78 which are used by the SysV runlevel compatibility code in systemd.
79 See
80 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
81 for details).</para>
c129bd5d
LP
82 </refsect1>
83
84 <refsect1>
45f09f93 85 <title>Implicit Dependencies</title>
f749954d 86
45f09f93
JL
87 <para>There are no implicit dependencies for target units.</para>
88 </refsect1>
89
90 <refsect1>
91 <title>Default Dependencies</title>
92
93 <para>The following dependencies are added unless
94 <varname>DefaultDependencies=no</varname> is set:</para>
95
96 <itemizedlist>
97 <listitem><para>Target units will automatically complement all
98 configured dependencies of type <varname>Wants=</varname> or
99 <varname>Requires=</varname> with dependencies of type
c85f1346
YW
100 <varname>After=</varname> unless <varname>DefaultDependencies=no</varname>
101 is set in the specified units. Note that <varname>Wants=</varname> or
45f09f93
JL
102 <varname>Requires=</varname> must be defined in the target unit itself — if
103 you for example define <varname>Wants=</varname>some.target in
104 some.service, the automatic ordering will not be added.</para></listitem>
105
106 <listitem><para>Target units automatically gain <varname>Conflicts=</varname>
107 dependency against <filename>shutdown.target</filename>.</para></listitem>
108 </itemizedlist>
798d3a52
ZJS
109 </refsect1>
110
259d1af8
JH
111 <refsect1>
112 <title>Example</title>
113
114 <example>
115 <title>Simple standalone target</title>
116
117 <programlisting># emergency-net.target
118
119[Unit]
120Description=Emergency Mode with Networking
121Requires=emergency.target systemd-networkd.service
122After=emergency.target systemd-networkd.service
123AllowIsolate=yes</programlisting>
124
125 <para>When adding dependencies to other units, it's important to check if they set
126 <varname>DefaultDependencies=</varname>. Service units, unless they set
127 <varname>DefaultDependencies=no</varname>, automatically get a dependency on
128 <filename>sysinit.target</filename>. In this case, both
129 <filename>emergency.target</filename> and <filename>systemd-networkd.service</filename>
130 have <varname>DefaultDependencies=no</varname>, so they are suitable for use
131 in this target, and do not pull in <filename>sysinit.target</filename>.</para>
132
133 <para>You can now switch into this emergency mode by running <varname>systemctl
134 isolate emergency-net.target</varname> or by passing the option
135 <varname>systemd.unit=emergency-net.target</varname> on the kernel command
136 line.</para>
137
138 <para>Other units can have <varname>WantedBy=emergency-net.target</varname> in the
139 <varname>[Install]</varname> section. After they are enabled using
140 <command>systemctl enable</command>, they will be started before
141 <varname>emergency-net.target</varname> is started. It is also possible to add
142 arbitrary units as dependencies of <filename>emergency.target</filename> without
143 modifying them by using <command>systemctl add-wants</command>.
144 </para>
145 </example>
146 </refsect1>
147
798d3a52
ZJS
148 <refsect1>
149 <title>See Also</title>
150 <para>
151 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
153 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
154 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
155 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
156 </para>
157 </refsect1>
da49e9ab
LP
158
159</refentry>