Is there any way to prevent temporally suspend/hibernate from a script?
I want the screen to enter in powersave mode when appropriate, but the computer doesn't stop.
Caffeine
doesn't allow this: it disables all or nothing.
Why I want to do this? Because sometimes I download huge amount of files from a server via FTP. These downloads can take hours to complete.
To prvent hibernation, create
/var/run/do-not-hibernate
:The file
/usr/lib/pm-utils/sleep.d/000kernel-change
makes this work. If you need to disable suspend, create a new file for that, say/etc/pm/sleep.d/000_prevent_suspend_hibernate
:Make it executable:
In case you need to prevent the machine from suspending or hibernating, create a file:
After rebooting or removing this file, suspending and hibernating works again.
Simply add a file to
/etc/pm/sleep.d
In this file do you checks if suspend should be allowed. If not just exit withexit 1
.For example: