Is there a command line way to disable suspend in ubuntu 12.04?
I can only ssh to my 12.04, is there a way to disable suspend mode via command line?
This should work (adapted from here).
Create a file
[Disable suspend] Identity=unix-user:* Action=org.freedesktop.upower.suspend; ResultAny=no ResultInactive=no ResultActive=no
On Ubuntu 16.04 LTS (which uses systemd, unlike 12.04), I successfully used the following to disable suspend:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
And this to re-enable it:
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target