Inhibiting hibernate
(too old to reply)
Martin Schlatter
2017-09-16 11:01:33 UTC
Raw Message
My system: Ubuntu 17.04 , Linux 4.10.0-33, systemd 232-21ubuntu5

For a backup program, I wanted to prevent that the backup program is interrupted by a suspend, sleep, hibernate oder shutdown which would cause
the backup to be destroyed. And if the backup runs automatically in the background, the user would not notice that.

So I tried

sudo systemd-inhibit --why="backup running" --who="backup program xyz"
--what="shutdown:sleep:idle:handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch" sleep 60

(sleep 60 of course only for testing)

This successfully inhibits a suspend (sleep). But if I tell the system to hibernate via the unity menu, the system hibernates, so the inhibit
does not work. Is this a bug? Also I wonder why there are keywords for shutdown, idle and sleep, but not for hibernate?