Does Systemd read /etc/pm/.....?
Scripts in /etc/pm/config.d|power.d|sleep.d
are ignored under systemd. Instead a systemd "unit" (service) must be created and enabled.
To restart networking after the system resumes from sleep I created the file /lib/systemd/system/root-resume.service
:
[Unit]
Description=Local system resume actions
After=suspend.target
[Service]
Type=oneshot
ExecStart=/bin/systemctl restart network-manager.service
[Install]
WantedBy=suspend.target
Then I activated the service with sudo systemctl enable root-resume.service
. Enabling the service creates a symbolic link for the file in /etc/systemd/system/suspend.target.wants/
Contrary to man systemd-sleep
service files placed in /lib/systemd/system-sleep/
are ignored.
No, nor those in /usr/lib/pm-utils/sleep.d
. But it runs all scripts (not service files) in /lib/systemd/system-sleep/
with executable bits set.
Here's an example one for calling pm-powersave, modified from /usr/lib/pm-utils/sleep.d/00powersave
.
#!/bin/sh
# do not run pm-powersave on ARM during suspend; the 1.5 seconds that it takes
# to run it don't nearly compensate the potentially slightly slower suspend
# operation in low power mode
ARCH=`uname -m`
case $1 in
pre) [ "$ARCH" != "${ARCH#arm}" ] || pm-powersave false ;;
post) pm-powersave ;;
esac
exit 0
$1 is "post" on resume, "pre" otherwise. $2 in both cases contains either "suspend", "hibernate", or "hybrid-sleep".