I have a (trivial) custom service which runs on resume from ACPI S3 ("suspend"), the script simply wakes up a server by WOL (Wake On LAN).
This is driven by systemd, the script resides in /etc/systemd/system/on_resume.service and was added by:
chmod +x on_resume.service
systemctl enable on_resume.service
systemctl status on_resume.service
The problem is that the script only runs when the system is put into sleep by using the "Suspend" widget in XFCE (a simple pushbutton from a menu).
If I do echo "mem" > /sys/power/state, the system also gets put into sleep, but the service does not run when the system is brought back on.
In both cases I simply push the power button to bring it back.
The question is, what is the difference between these two methods of putting the system into S3, if any? Why does systemd only run the script when using XFCE's feature?
For simplicity, assume that the script has the following simple content (this particular script was used for testing, and has the exact same problem, it is therefore a minimal version to reproduce the problem):
#!/bin/sh
case "$1" in
thaw|resume)
echo "test" > /tmp/testfile_resume
;;
esac
exit 0
I do lock the screen through the "power manager" of XFCE when the system is put to sleep, however, I tried turning this off, and it still works using XFCE's "Suspend" pushbutton.
I then attempted to compare syslog when using the widget and using the sys filesystem manually, but there doesn't appear to be anything there to indicate a failure or anything noteworthy that sticks out.
What is the difference?
Note that I don't really care in terms of functionality, I'm perfectly fine using a pushbutton instead of typing the command, but I want to understand why.