Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
I wonder if PowerNap/PowerWake helps you... They seem to only provide Ubuntu packages, but maybe this helps you still (if only as prior art). –  sr_ Nov 12 '12 at 14:10
    
Thanks, I should be able to build this on Mint. But I'm actually after something much simpler that will just monitor keyboard and mouse activity even when no desktop or terminal session is active. –  ziyan Nov 13 '12 at 11:37
    
One of the thousands of possibilities systemd brings could be useful: "Keeping track of users and sessions, their processes and their idle state" (I just lack further knowledge, sorry) –  sr_ Nov 13 '12 at 12:11
    
Yup, systems is supposed to provide much better session tracking. But until Debian or Mint picks it up it's not an option. I'm actually a bit surprised that there isn't much information about desktop-independent power management. –  ziyan Nov 14 '12 at 11:59
    
You can boot Debian with systemd; not sure if everything needed (and which version) is there, though... –  sr_ Nov 14 '12 at 12:26
add comment

2 Answers 2

I would run a script through cron that checks the output of who then suspends when the output is either empty or something that you have predetermined to be acceptable. While this does work for logins, which is what you asked, it won't work for idle sessions where the user has left the machine without logging off. For this you may want to use xautolock to monitor for idleness, which can be configured to execute the logout command, then wait for the cron to perform the suspension.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.