You are here

Automatic sleep on DICE machines

Printer-friendly versionPrinter-friendly version

Most computers will sleep when idle. DICE Linux computers are no exception. This page is about sleep on DICE. There is a separate page about sleep on Windows Managed Desktop. If you have a question which isn't answered here please ask Computing Support.

Does my computer sleep?

Most DICE desktop computers can sleep, but not all. A few models of computer (HP EliteDesk G2, Lenovo P310) do not support sleep properly. Sleep is currently disabled on these models. Sleep will be enabled on them when it works reliably.

How do I send my machine to sleep?

The computer will automatically sleep after it has become idle. You can help it to be idle either by logging out or by locking the screen. To lock the screen choose Screen Lock from the Applications -> Other menu in GNOME or the System menu in MATE or the Applications -> Settings menu in KDE. (To find out more about GNOME, MATE and KDE see Window managers on SL7.)

I want the computer to sleep right now.

If the computer is idle it should usually fall asleep within a few minutes. Occasionally it may have to stay awake so that an automatic management process can run: see Why does the computer wake up by itself?. It may also stay awake because someone has logged in to it remotely, or because the computer is busy. For these reasons it's not a good idea to have a "sleep right now" command. If you have your own DICE computer you can ask Computing Support to change the sleep settings to make it go to sleep more quickly.

How do I wake the computer?

If you have the computer in front of you, either press a key on the keyboard or press the computer's power button once. If you are elsewhere in the world but need to wake your computer, read Remote wake-up for sleeping computers to learn how to wake it from a web browser.

Why does the computer wake up by itself?

DICE computers are managed and configured automatically. That automated management can happen at any time during the day or night, often when computers would be likely to be sleeping. To cope with this, DICE computers automatically up when it's time to to perform the automated management.

Something has gone wrong.

If you think that sleep has caused a problem please tell Computing Support.

How do I temporarily stop the computer from sleeping?

To keep the computer awake while it runs a long-running command, prefix that command with nosleep. For instance to protect an ssh session from sleep you might type

nosleep ssh

As long as your command (which you have prefixed with nosleep) is still running, the computer should stay awake.

How do I permanently stop the computer from sleeping?

Before doing this please satisfy yourself that there is no alternative course of action. To permanently stop sleep on your computer type

om sleep disable

To reverse that and enable sleep again type

om sleep enable

These commands will normally only work on a computer which is allocated to you.

ssh, firefox and thunderbird

Some applications, particularly ssh, firefox and thunderbird, can react badly to sleep. If this happens regularly, and you find yourself having to kill or restart a program after the machine has slept, try using the nosleep command with that application - for instance start firefox with the command nosleep firefox &. This should keep the computer awake as long as the command is still running.

Why send computers to sleep?

The University is committed to minimising its environmental impact. See for instance the University's current strategic plan.

Where can I find the software?

The software which we use to manage sleep is called The LCFG sleep component or lcfg-sleep for short. You can see it at, or download it from, the LCFG Subversion repository. It's written in Perl and is a component of the LCFG configuration system.

How can I change the sleep preferences?

To change the behaviour of the LCFG sleep component for your machine, ask computing support. They will change the machine's sleep settings for you.

When has my computer been asleep?

All recent sleeping and waking is logged in the files matching /var/lcfg/log/sleep.activity*.

If I add a cron job, will the computer wake for it?

If you add a cron job to your computer (for instance using crontab -e) the sleep software should notice your cron job and ensure that the machine will be awake at the right time to run it.

When will the computer decide to sleep, in detail?

The sleep software runs every three minutes. Its actions are logged in the file /var/lcfg/log/sleep. The last twenty or so lines at the bottom of that file should show the result of the most recent run of the sleep software. Each time it runs a number of tests are done and each produces a "Sleep OK" or "Sleep veto" result. Sleep can only start if there are no veto results. These are the tests:

  • test_imminent_cron looks for important cron jobs which are due to run soon. If it finds one it vetoes sleep. cron jobs which have been added by users count as "important" for this test, so the machine should be awake to run them.
  • load average looks to see if the machine's load average is below the sleep limit (set to 0.1 at the time of writing).
  • idle time checks that the idle time of each interactive user shell is over the limit (set to 3 hours at the time of writing).
  • minawake checks that the computer has been awake for the specified minimum period (1 minute).
  • console activity will agree to sleep only if the
    computer's keyboard and mouse have been idle for a while. Note that this test currently only works when the GNOME environment is used. (GNOME is DICE's default environment.) We're working on a fix for idleness detection for other environments (KDE, fvwm, Ice, Xfce, etc.). Until that fix is ready users of these environments will probably find that session idleness is not detected so the machine won't sleep during a login session.
  • video checks for known good or bad video driver software.
  • current cron stops sleep if an important cron job is currently running.
  • disabled checks to see if you have disabled sleep on this computer.
  • blacklist prevents sleep if the computer's hardware model is on a blacklist (a few models react badly to sleep).
  • nosleep command stops sleep if the nosleep command is currently in use.
  • minsleep permits sleep only if the machine would sleep for longer than a permitted minimum period, set to half an hour at the time of writing.

In addition the cron jobs are listed in two categories, those worth waking the machine for and the others; and the machine's next wake-up time is announced and set. For more detail see the man page (type man lcfg-sleep to see it) or look at the source.

Last reviewed: 

System Status

Home dirs (AFS)
Other services
Scheduled downtime

Choose a topic