How to get suspend when idle if no user logged in (lightdm)

Solution 1:

Install sleepd.

sudo apt-get install sleepd

By default, the system will go to sleep after 10 minutes of inactivity. Settings can be changed in /etc/defaults/sleepd. Set the PARAMS variable with -u [number of seconds] to set the number of seconds of inactivity that will cause the system to sleep. Check out the manpage for more options.