Running a program when computer enters/exits idle state
Howdie, fellow Debianites!
I've bee all over uncle G to crack this one, but to no avail. In short:
how would you go about launching a program when the computer is idle,
and launching another program when the computer stops being idle?
Specifically, I'd like my computer to switch CPU governors from
powersave to performance and vice versa, with "cpufreq-set --governor
foobar".
What I've tried so far:
* loadwatch: can make it switch governors when average load drops, but
can't make it do zilch when average load rises (at that point loadwatch
just *freezes* the target program, so it basically can't *do* anything)
* xautolock: ditto. It has provisions for launching a program when X is
idle (no keyboard/mouse activity), but has no provisions for launching
anything when X *ceases* being idle
* another approach I haven't been able to try out because of my very
non-existent bash skills: writing a script to periodically
parse/cut/grep the output of the "w" command and launch the
corresponding CPU governor.
Are there other -- preferably easier -- approaches to this? As you may
see, I'm not being picky as to how "idle" is defined: it may be no X
usage, it may be low average load, it may be no user activity, you
choose.
Why I need this: my Pentium IV uses the p4_clockmod cpu scaling module,
which has a high latency. Using the (recommended) ondemand CPU governor
yields a very noticeable lag and leaves the CPU at low clocks even when
maximum performance is required. With the performance CPU governor, on
the other hand, the things feel real snappy again, but the fans start
to roar and heat to build up, so I'd really like it to switch to
powersave when not in use.
--
TIA, and excuse the verbosity (English is not my "mother's thong")
Klistvud
Certifiable Loonix User #481801
http://bufferoverflow.tiddlyspot.com
Reply to: