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