From 259d1af8d6fbb4918a3d43597dbca8cafe06a979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Tue, 27 Jun 2017 09:50:28 +0200 Subject: [PATCH] doc: Add an example for target units (#5951) This adds an example target unit to the man page of systemd targets. Closes #67. --- man/systemd.target.xml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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 @@ -98,6 +98,43 @@ + + Example + + + Simple standalone target + + # emergency-net.target + +[Unit] +Description=Emergency Mode with Networking +Requires=emergency.target systemd-networkd.service +After=emergency.target systemd-networkd.service +AllowIsolate=yes + + When adding dependencies to other units, it's important to check if they set + DefaultDependencies=. Service units, unless they set + DefaultDependencies=no, automatically get a dependency on + sysinit.target. In this case, both + emergency.target and systemd-networkd.service + have DefaultDependencies=no, so they are suitable for use + in this target, and do not pull in sysinit.target. + + You can now switch into this emergency mode by running systemctl + isolate emergency-net.target or by passing the option + systemd.unit=emergency-net.target on the kernel command + line. + + Other units can have WantedBy=emergency-net.target in the + [Install] section. After they are enabled using + systemctl enable, they will be started before + emergency-net.target is started. It is also possible to add + arbitrary units as dependencies of emergency.target without + modifying them by using systemctl add-wants. + + + + See Also