From dbc2cb76d631046ddc6039523595eeb962e5f454 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Sat, 23 Feb 2013 11:10:14 +0100 Subject: Introduce sleep hook (FS#33829) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a store/restore hook to the sleep target of systemd. Thanks to: Claudio Kozický. --- docs/netctl.special.7.txt | 5 +++++ services/netctl-sleep.service | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 services/netctl-sleep.service 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@ 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@.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 -- cgit v1.2.3-24-g4f1b