gabriel rosenkoetter on 19 Oct 2006 21:09:59 -0000 |
On Thu, Oct 19, 2006 at 10:58:31AM -0700, jadoba@jadoba.net wrote: > I'd like to create a shell script that will execute 'ifconfig eth0 down' > when both the mouse and keyboard have been idle (iow, no input) for a > set amount of time. I would also like for the same script to bring eth0 > back up when a key is pressed or the mouse is moved. The "run a cron job once a minute" techniques seem like a huge waste of resources to me. You want to be hooking into something that's already polling for human I/O events (if this were NetBSD, I'd say "wscons") and registering (and then renewing later) a timer on them which, if expired takes action. Maybe the Linux distribution involved makes use of something like SCIM: http://www.scim-im.org/ which looks like it probably provides some hooks for monitoring keydown/keyup mousedown/mouseup. Another decent place to look is the XScreenSaver source; checking the same places it does for I/O information should work, and you could run the process that checks and downs/ups the interface in the same way (automatically forking and sitting in the background till an exit request is passed to it later). -- gabriel rosenkoetter gr@eclipsed.net Attachment:
pgpe4vTISbVgE.pgp ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|