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

Is it possible to set up lightdm to hibernate after, for example, 5 minutes without human activity? Only in LightDM without this behaviour after login? I whant to be able just logout to lightdm by pressing Ctrl+Alt+Del and it would hibernate after timeout automatically instead of power off or hibernate my computer.

share|improve this question

You could do this, but it won't be simple. First you can setup a script that runs when lightdm starts the display. Since it restarts the display when you logout, you'd write a small script that has a 5 minute timer in it that hibernates after a 5 minute delay. You'd set lightdm.conf to run this script by editing the config file like so:

You could then have a second script that lightdm runs when starting a user session that would cancel the timer. You set that in lightdm.conf as follows:

As for the contents of those scripts, they could be simple. would be something like this, although you'd need to do the parts after the "touch" line in a second script that ran in the background:

touch /tmp/hibernate_timer
sleep 300
if [ -f /tmp/hibernate_timer ];
  echo "5 minutes is up, hibernating"
  pmi action hibernate
  echo "hibernation cancelled"

The script would simply remove the hibernate_timer file so that it doesn't hibernate:

rm -f /tmp/hibernate_timer

Now the theory here in my answer is sound, but I've not tried those scripts and like I mention above, the script needs to fork off a second script so that the sleep doesn't block. I'm sure there's also a better way to do this (using the command at is worth a look), but the hook-up points to lightdm would be the same.

Good Luck!

share|improve this answer
Beautiful! Big thanx! I'll try it! – Speranskiy Jan 13 '13 at 12:11
it hangs up lightdm after reboot and after logout, I can see just blackscreen, but after hibernating that works perfect lightdm starts normal. I'll try to find errors in log-file. – Speranskiy Jan 20 '13 at 7:12

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.