Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 recently installed Ubuntu 12.04 Server and am looking for away for get the server to suspend after an idle time. When using the desktop version I could use the Gnome powersaving tool to specify the idle time. As I have no GUI on the server is there a way to set the server idle time via the commandline/config file?

I will send the server a wake-on-lan packet to wake it up, if it is suspended and I need to use it.

share|improve this question
You are not supposed to auto suspend a server. What do you want to achieve? The server will not provide any services while in suspend. – Paul Hänsch Oct 29 '12 at 15:13
My server is not always in use. I would like it to suspend when it is idle. I will send it a wake-on-lan when I need to wake it up. – ssanj Oct 29 '12 at 15:57

OK, there is the hibernate program, which can send your computer to suspend or hibernate from commandline. Determine if your computer is "idle" is going to be trickier.

On a graphical desktop you would use mouse and keyboard input. Obviously in this scenario this is out of the question.

You should start by writing a shellscript, doing some custom idle checks. You can call this script via a cron job every 5 minutes or so.

You could consider your server idle, if no users are logged in (check this with who) or if there are no network connections in use (check with netstat) or if the cpu load is low (check for example with top -n 1 -b). You will have to find your own heuristics.

share|improve this answer
Thanks for the hints. I would have assumed that the checks done by the gnome powersaving tool would be "available" somewhere. Seems a little unnecessary to roll your own scripts when there are standard programs that do the same thing. – ssanj Oct 29 '12 at 22:02
Unfortunately the checks done by the gnome powersaving tool do realy just refer to the input devices directly attached to the computer. – Paul Hänsch Oct 29 '12 at 22:09

If you go to System>Preferences>Screensaver you can set the idle time there. Just set the preferred time on the bar! Plus if you want to set the picture it's on the same menu.

Jago Gardiner

share|improve this answer
I am running the "server" version of Ubuntu which does not have a GUI/Gnome. – ssanj Oct 29 '12 at 15:58
Ok. Sorry about that. – horIzoN Oct 29 '12 at 16:26

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.