On Wed, 2 Mar 2022 12:26:04 +0100 (CET)
"Carlos E. R."
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Yesterday night I told the machine to hibernate and left the room. This morning I came back and found the machine running, using electricity. Hibernation had failed, reason not clear. It is not the first time.
I don't care for the reason, usually a second try succeeds. But I have to notice. Waiting is not it, sometimes hibernation just takes long to complete. I want to know when it failed. The log does show it failed.
What I want is to trigger some script when it fails. The script will tell me, somehow, like ringing a bell. How do I launch that script?
Long ago we decided there was no way to do it. Is there now some way?
Surely it's easy? You just have a script always running consuming the log. When it recognizes a failure (the text 'Failed to suspend system' seems suitable) it does whatever you want. Play a sound, send an email or a text or whatever.
To hibernate, I do, as root:
sudo /usr/bin/systemctl hibernate
which always return before completing. [snip]