Debian – System-wide power management policy on debian-based distros

debiangdmpower-managementsuspend

I would like to put idle machines in our lab (running Mint Debian edition) on standby after a timeout. I have tried pm-suspend and it puts the machines on standby and wakes up fine.

Does anybody know how to set a system-wide power policy that will be in force when no user is logged in? I've tried packages like laptop-mode-tools but it doesn't offer a suspend timeout.

Ideally this should be completely independent of desktop environment. The only solution I found by googling is to hack a GDM logout hook with xautolock calling pm-suspend after a timeout.

Best Answer

If you really don't care about people connected via ssh or similar, just check the number of interrupts genereated by the keyboard. On my PC this is in /proc/interrupts as i8042. I think you'll have some more complex workflow if you have an USB keyboard.

In order to check if anyone is still connected with a window manager, just check if /usr/bin/Xorg is running, without counting any DM login screen.

Related Question