]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.target.xml
Merge pull request #7123 from keszybz/date-formatting
[thirdparty/systemd.git] / man / systemd.target.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
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
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
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
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.target">
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>
80 </refsect1>
81
82 <refsect1>
83 <title>Implicit Dependencies</title>
84
85 <para>There are no implicit dependencies for target units.</para>
86 </refsect1>
87
88 <refsect1>
89 <title>Default Dependencies</title>
90
91 <para>The following dependencies are added unless
92 <varname>DefaultDependencies=no</varname> is set:</para>
93
94 <itemizedlist>
95 <listitem><para>Target units will automatically complement all
96 configured dependencies of type <varname>Wants=</varname> or
97 <varname>Requires=</varname> with dependencies of type
98 <varname>After=</varname> unless <varname>DefaultDependencies=no</varname>
99 is set in the specified units. Note that <varname>Wants=</varname> or
100 <varname>Requires=</varname> must be defined in the target unit itself — if
101 you for example define <varname>Wants=</varname>some.target in
102 some.service, the automatic ordering will not be added.</para></listitem>
103
104 <listitem><para>Target units automatically gain <varname>Conflicts=</varname>
105 dependency against <filename>shutdown.target</filename>.</para></listitem>
106 </itemizedlist>
107 </refsect1>
108
109 <refsect1>
110 <title>Example</title>
111
112 <example>
113 <title>Simple standalone target</title>
114
115 <programlisting># emergency-net.target
116
117 [Unit]
118 Description=Emergency Mode with Networking
119 Requires=emergency.target systemd-networkd.service
120 After=emergency.target systemd-networkd.service
121 AllowIsolate=yes</programlisting>
122
123 <para>When adding dependencies to other units, it's important to check if they set
124 <varname>DefaultDependencies=</varname>. Service units, unless they set
125 <varname>DefaultDependencies=no</varname>, automatically get a dependency on
126 <filename>sysinit.target</filename>. In this case, both
127 <filename>emergency.target</filename> and <filename>systemd-networkd.service</filename>
128 have <varname>DefaultDependencies=no</varname>, so they are suitable for use
129 in this target, and do not pull in <filename>sysinit.target</filename>.</para>
130
131 <para>You can now switch into this emergency mode by running <varname>systemctl
132 isolate emergency-net.target</varname> or by passing the option
133 <varname>systemd.unit=emergency-net.target</varname> on the kernel command
134 line.</para>
135
136 <para>Other units can have <varname>WantedBy=emergency-net.target</varname> in the
137 <varname>[Install]</varname> section. After they are enabled using
138 <command>systemctl enable</command>, they will be started before
139 <varname>emergency-net.target</varname> is started. It is also possible to add
140 arbitrary units as dependencies of <filename>emergency.target</filename> without
141 modifying them by using <command>systemctl add-wants</command>.
142 </para>
143 </example>
144 </refsect1>
145
146 <refsect1>
147 <title>See Also</title>
148 <para>
149 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
153 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
154 </para>
155 </refsect1>
156
157 </refentry>