diff options
Diffstat (limited to 'man')
-rw-r--r-- | man/systemd.target.xml | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/man/systemd.target.xml b/man/systemd.target.xml index b3cccd4e52..dbe7ff014b 100644 --- a/man/systemd.target.xml +++ b/man/systemd.target.xml @@ -99,6 +99,43 @@ </refsect1> <refsect1> + <title>Example</title> + + <example> + <title>Simple standalone target</title> + + <programlisting># emergency-net.target + +[Unit] +Description=Emergency Mode with Networking +Requires=emergency.target systemd-networkd.service +After=emergency.target systemd-networkd.service +AllowIsolate=yes</programlisting> + + <para>When adding dependencies to other units, it's important to check if they set + <varname>DefaultDependencies=</varname>. Service units, unless they set + <varname>DefaultDependencies=no</varname>, automatically get a dependency on + <filename>sysinit.target</filename>. In this case, both + <filename>emergency.target</filename> and <filename>systemd-networkd.service</filename> + have <varname>DefaultDependencies=no</varname>, so they are suitable for use + in this target, and do not pull in <filename>sysinit.target</filename>.</para> + + <para>You can now switch into this emergency mode by running <varname>systemctl + isolate emergency-net.target</varname> or by passing the option + <varname>systemd.unit=emergency-net.target</varname> on the kernel command + line.</para> + + <para>Other units can have <varname>WantedBy=emergency-net.target</varname> in the + <varname>[Install]</varname> section. After they are enabled using + <command>systemctl enable</command>, they will be started before + <varname>emergency-net.target</varname> is started. It is also possible to add + arbitrary units as dependencies of <filename>emergency.target</filename> without + modifying them by using <command>systemctl add-wants</command>. + </para> + </example> + </refsect1> + + <refsect1> <title>See Also</title> <para> <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |