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).