O 02/03/22 ás 12:49, Dave Howorth escribiu:
On Wed, 2 Mar 2022 12:26:04 +0100 (CET) "Carlos E. R."
wrote: 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
Instead of always running, you can try to create a systemd unit that runs after hibernate.target.
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.