summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2013-02-23 11:10:14 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2013-02-23 11:13:14 +0100
commitdbc2cb76d631046ddc6039523595eeb962e5f454 (patch)
treec0afd8f58b28dd45affce8fbf3edbd8060ee7844
parentc446fad51d232e6553ca42bcba5930d9cb8556c6 (diff)
downloadnetctl-dbc2cb76d631046ddc6039523595eeb962e5f454.tar.gz
netctl-dbc2cb76d631046ddc6039523595eeb962e5f454.tar.xz
Introduce sleep hook (FS#33829)
This adds a store/restore hook to the sleep target of systemd. Thanks to: Claudio Kozický.
-rw-r--r--docs/netctl.special.7.txt5
-rw-r--r--services/netctl-sleep.service13
2 files changed, 18 insertions, 0 deletions
diff --git a/docs/netctl.special.7.txt b/docs/netctl.special.7.txt
index 6e80d7d..9520385 100644
--- a/docs/netctl.special.7.txt
+++ b/docs/netctl.special.7.txt
@@ -38,6 +38,11 @@ systemctl disable netctl@<profile>
This way the unit configuration file for the profile remains in
existence, while the profile is not enabled.
+netctl-sleep.service::
+ When enabled, this unit stores and stops the active network profiles
+ before the machine is put to sleep. After the system is resumed,
+ previously stored profiles are restarted.
+
netctl-auto@<interface>.service::
This unit issues a scan on the interface it is used for and tries to
start a profile for a network it finds. It is targeted to wireless
diff --git a/services/netctl-sleep.service b/services/netctl-sleep.service
new file mode 100644
index 0000000..301dc36
--- /dev/null
+++ b/services/netctl-sleep.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=netctl sleep hook
+Before=sleep.target
+StopWhenUnneeded=yes
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/netctl store ; /usr/bin/netctl stop-all
+ExecStop=-/usr/bin/netctl restore
+
+[Install]
+WantedBy=sleep.target