You are not logged in.
I'm looking for a simple solution to auto-suspend (ram/disk) a system after a certain time of inactivity. I can find surprisingly little info for this for linux (or perhaps i'm not looking in the right places), while windows for instance has this built in for years already.
The idea is simple but maybe tricky in practice; if there is no user input for x seconds, no video/audio playing or continuous disk/network usage, suspend the system. Basically the system just needs to be idle for a certain amount of time.
Does anyone know or have a working script or utility for this, or is writing one myself the only solution? The simplest approach i can think of is a combination of checking user idle time (with 'w') and sysload, though it might be necessary to determine a threshold for the latter to avoid simple jobs (cron etc.) producing a 0.01 sysload and thus preventing suspend.
Any other thoughts or suggestions about this?
Last edited by litemotiv (2010-05-07 11:03:55)
ᶘ ᵒᴥᵒᶅ
Offline
xscreensaver should be able to do this.
Offline
xscreensaver should be able to do this.
afaik xscreensaver only checks for user interaction, or requires 3rd party software (mplayer etc.) to explicitely keep-alive the system. i don't consider that a generic solution.
ᶘ ᵒᴥᵒᶅ
Offline
Have a look at 'sinac' in aur. Maybe in .xinitrc you could:
while : ; do
sinac -w 300
slock ## if you want to lock your screen
pm-suspend
done
Last edited by steve___ (2010-04-29 13:18:57)
Offline
Have a look at 'sinac' in aur.
from the source it seems to only check the X idle time through libxss, basically the same as xscreensaver?
ᶘ ᵒᴥᵒᶅ
Offline
Ahh you're not in X. I didn't understand this.
Offline
sleepd-git works for me so I added it to AUR a while ago. No X required.
Last edited by Profjim (2010-04-30 17:19:58)
Offline
that looks very promising Profjim, thanks!
ᶘ ᵒᴥᵒᶅ
Offline
Profjim, don't know if you're still reading: with sleepd, do you know if it's possible to check for audio playing? i have an mpd instance running on the target machine which sometimes drops below measurable sysload (0.00), so i wonder how i could avoid suspend for that scenario with sleepd?
ᶘ ᵒᴥᵒᶅ
Offline
I don't know. It's pretty configurable what it looks for, but I just use the default (watch keyboard and mouse activity). A quick read of the man page didn't provide an answer to your need. But this is the only lightweight daemon I've found for doing this kind of thing. (The only other options I've seen are gnome-power-manager, etc.) So why don't you look into it and see what you find. Report back here if you find a solution, or an alternative that you think is more promising.
Offline
maybe xautolock in combination with pm-utils could help you too
"The mind can make a heaven out of hell or a hell out of heaven" -- John Milton
Offline
muunleit: see the earlier posts, solutions depending on libxss will only check for user-input (mouse/keyboard). xautolock basically does the same thing as xscreensaver and sinac.
i have now added the hda-intel irq to sleepd's watchlist, that seems to work well. if linux doesn't decide to change the irq on reboot, this could be a working approach.
ᶘ ᵒᴥᵒᶅ
Offline
i have now added the hda-intel irq to sleepd's watchlist, that seems to work well. if linux doesn't decide to change the irq on reboot, this could be a working approach.
What are your exact changes? I'm assuming you added soemthing like this to the PARAMS array in /etc/conf.d/sleepd:
...
-i somethingorother
-a
...
Offline
Sorry for hijacking your thread but I tryed sleepd to suspend and lock my screen after a certain amount of time. So far it's working smoothly except when I am watching something with xbmc.
So I just set --load=1 in /etc/conf.d/sleepd but it still goes to suspend. And I verified with the key o in xbmc that the cpu load is higher than 1%. I also added "-N" as sometime I let my computer download stuff for me in the background.
PARAMS=("--unused=600" "--ac-unused=600" "--load=1" "-N" "--sleep-command=su lymphatik -c slock & dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0" "--battery=2" "--hibernate-command=dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate int32:0")
Last edited by lymphatik (2010-05-01 12:56:42)
Offline
Profjim:
"--irq=22" "--auto" "--load=0.01"
lymphatik:
a load of 1 is quite high (100% for 1 core), try lowering it to 0.1 for 10% or 0.01 for 1%
ᶘ ᵒᴥᵒᶅ
Offline
Oh ok thanks I thought it was in percent ;( thanks.
And litemotiv you might want to add "-N" for internet or ethernet activity.
Offline
And litemotiv you might want to add "-N" for internet or ethernet activity.
i figured that any network activity would surely raise sysload above 0.01
ᶘ ᵒᴥᵒᶅ
Offline
i raised the sysload threshold to 0.25 and sleepd has been working great on both my laptop and atom-server for about a week now. i'm going to mark this topic solved.
ᶘ ᵒᴥᵒᶅ
Offline