[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running a program when computer enters/exits idle state [UPDATE]



To whom it may concern
Running a task when the computer is idle and stopping the task when it's not idle

what I've considered so far and either doesn't work or is too much hassle:
*finger* - only yields tty usage (useless for tracking X usage)
*w* - ditto
*xscreensaver* w/ *xscreensaver-command* SEEMED to be promising but turned out to be FAR too much hassle. Xscreensaver can't be set up system-wide and in a simple manner. I would have to set up separate xscreensaver instances for every single user on my system and track every single user's idle time -- far too much hassle for my simple task. *loadwatch* - can track idle time start, but can't track when idle condition stops
*xautolock* - ditto
*idleize* - as its website is in reconstruction, I couldn't get hold of it, so can't really say anything.

My temporary solution -- a cron script run every minute:

------------------<snip>-----------------
#!/bin/bash

maxloadavg=0.20

loadavg=$(cat /proc/loadavg | cut -c1-4)
if [ `expr $loadavg \< $maxloadavg` -eq 1 ]; then
        cpufreq-set --governor ondemand
else
        cpufreq-set --governor performance
fi
-----------------<pins>------------------

Future plans: managing to make *xprintidle* work. By default, it will only yield the idle time of the CURRENT display/user. Need urgent advice on how to make it parse ALL X displays used on a system; preferably an one-liner or a very simple script snippet. If this could be done in a concise manner, it could potentially benefit many GNU/Linux users who seem to be on the search after such a functionality.

--
Regards, and sorry for the verbosity again,

Klistvud
Certifiable Loonix User #481801
http://bufferoverflow.tiddlyspot.com


Reply to: