Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have enabled the gnome (2.30) screensaver and set it to suspend the machine after so many minutes. It works fine!

Now, there are cases that I want to use the machine in "server mode". That is, there would not be physical activity on the machine while it serves files, or acts as a ssh terminal. As there is not physical activity, the machine would suspend after the time elapses. Is there a utility/script/something to inhibit suspend?

ps. I had no luck with the dbus/python scripts do circulate in the Internet, nor is the "inhibit" applet anywhere available in my gnome distribution. I use ubuntu lucid.

share|improve this question
up vote 1 down vote accepted

You can prevent the computer going to sleep automatically with these commands:

gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_computer_battery --type int 0
gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_computer_ac --type int 0

It will set the corresponding gconf database keys, the first one determines after which time the computer goes to sleep when it's idle and on battery, the second one when it's on ac plug. Setting them at 0 disables automatic sleep (you may not want this behaviour when on battery). To set it back to, say, a 30 minute delay, you do:

gconftool-2 --set /apps/gnome-power-manager/timeout/sleep_computer_ac --type int 1800

You can browse the available gconf keys with gconf-editor, it may interest you.

share|improve this answer
Good answer. I will check it out. Both keys are named sleep_computer_ac, I suppose one should be sleep_computer_bat or something? – yannisf May 31 '11 at 8:56
sorry, the right key is sleep_computer_battery. Edited. – nodiscc May 31 '11 at 15:29
I am afraid it did not work. I double checked that the suggested command changes the value using gconf-editor (and it did it does) but still the machine sleeps. – yannisf Sep 25 '11 at 21:23
Alternatively you can do: gconftool-2 --set /apps/gnome-power-manager/actions/sleep_type_ac --type string nothing; gconftool-2 --set /apps/gnome-power-manager/actions/sleep_type_battery --type string nothing Does it work? – nodiscc Oct 17 '11 at 14:07

I think you need to change the "suspend after..." to its appropriate state manually, using the scripting language of your choice. I suspect this setting is stored via the gconf service, there is a python-gconf module that will allow you to adjust settings in this 'configuration service' programmatically (it's basically the Windows registry for Linux). Here's a tutorial on using python-gconf. You can use the Configuration Editor tool to hunt around gconf and see where the appropriate setting might be.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.