#!/bin/sh
case "$1" in
suspend|hibernate) echo "suspend" >> /tmp/fixit ;;
resume|thaw) echo "resume" >> /tmp/fixt ;;
esac
exit 0
sudo chmod +x 80_fixit
Command sudo pm_suspend ... the laptop went to suspend mode (power button is blinking).
Pushed the power button, laptop woke up. Looked at the file /tmp/fixit, it says
suspend
resume
You can also check /var/log/pm-suspend.log which logs the actions of every script that was in /usr/lib/pm-utils/sleep.d/ If I close the lid of my laptop, nothing happens since I have not defined this event as "suspend" -- probably I have it "do nothing"
There are two ways to test suspend, 1) force suspend with sudo pm-suspend or 2) close the lid assuming in power options you have defined what to do when lid is closed.
touch /tmp/fixit will create a zero bytes file. Then, if you use method 1) it will append to that file. I tried method 2, my laptop did not write a /var/log/pm-suspend.log but it wrote in /var/log/syslog that system is suspending. I have to figure out why.
On systems that run systemd (instead of init), it is preferable to use /lib/systemd/system-sleep/ and scripts will be called with "pre" and "post" parameters. In my example, I just wanted to show you how to approach the problem. Two years ago, I wrote an article about it, https://www.azloco.org/2019/04/06/systemd-suspend-resume-script/