9

Is there a way to inhibit suspend/hibernate from the command line. I want to ssh into my home computer and not have it suspend while I'm working on it.

3
  • Which version of Ubuntu is the remote machine running? Oct 25, 2011 at 17:01
  • The remote machine is running Gnome on Ubuntu 11.10.
    – user1477
    Oct 25, 2011 at 17:37
  • Is it an Ubuntu Server or desktop install? Are you sure the ssh connection is not just dying? Trying enabling keepalive and see if that makes a difference Oct 26, 2011 at 10:34

3 Answers 3

4

Use xdotool instead:

sudo apt-get install xdotool

Then, in a bash loop like this

while true ; do
    DISPLAY=:0.0 xdotool key Shift_L   # send a "harmless" keypress to Xorg
    sleep 5                            # wait a little bit and do it again
done
3

You also might want to try this script 1, it inhibits to suspend/turn off your machine, I use it when watching movies.

img

1 http://linuxtidbits.wordpress.com/2009/09/08/movietime-stop-powersaving-to-watch-a-movie/

0

You might want to disable power management in gnome-control-center.

2
  • Normally, I want my computer to suspend. It's a laptop and all. But when I ssh into it, I'd like suspend to be temporarily inhibited.
    – user1477
    Oct 25, 2011 at 17:38
  • 3
    Hm, perhaps find out which gconf (or dconf, in this brave new 11.10 world) keys enable/disable suspend, then write a couple of shell scripts to change them to enable/disable suspend from the command line. Oct 25, 2011 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .