Do systems using systemd
read and execute scripts in /etc/pm/sleep.d/
?
I'm starting to concluded the answer is that systemd
ignores these scripts. If this is true what is the replacement?
Update: man systemd-sleep
states scripts can be added to /lib/systemd/system-sleep/
. The details were insufficient for me but I tried a modification of an Arch wiki example and created /lib/systemd/system-sleep/root-resume.service
.
[Unit]
Description=Local system resume actions
After=suspend.target
[Service]
Type=simple
ExecStart=/bin/systemctl restart network-manager.service
[Install]
WantedBy=suspend.target
My intention is to restart network-manager after resuming because occasionally it isn't working.
This doesn't seem to be doing what I want.
Best Answer
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
: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.