I am using 14.04 (Trusty). I have Power -> Suspend when inactive for 2 hours. This works fine if I am logged in and then walk away. But if I am not logged in, it never suspends. Moreover, I understand that "inactive" means that I have not touched my mouse of keyboard; is does NOT mean that no background jobs are running.

My situation is that I have set rtcwake to de-suspend the machine in the middle of the night to do various routine tasks (e.g. as scheduled by cron or anacron). Some of these tasks might take a long time (e.g. if I a doing a backup). What I want is for the system to suspend when it detects that the CPU has at last gone idle. Note that, being logged off, the Xserver will not be running (or it will be running in a special "awaiting login" mode).

How do I set this up? In particular, I would prefer NOT to have to set this up within the cron jobs, because there might be two or more cron jobs running, and no way to know which will finish first (yes, I know there are messy and complicated ways of detecting this, but K.I.S.S. and all that).


I was having the same issue using deja-dup to backup from ubuntu 12.04 to a dedicated backup pc on ubuntu 14.04.

I made use of the second solution by dhiya from this question but just modified the interface string to eth0. i.e. changed: iface='wlan0' to: iface='eth0'

UPDATE 17/09/2015: I modified dhiya's code from the link underneath to keep a system awake based on network traffic or user activity and to force graceful suspension if the desktop session ends up in the lock/login screen with no network traffic. The program logs everything to a log file. Config has also been provided to manage the logfile. I have named the program "Keep Awake".

LINK: Is there any way to make Ubuntu not to suspend while a download in progress?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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