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