George Gallen on 19 Oct 2006 20:06:01 -0000 |
Have a cron job every minute look for :0 and if the time is more than you want, then do the ifconfig, only problem is when you want it to come back up, it might take a minute for the next cron instance to realize the idle time now less than to bring up eth0 > -----Original Message----- > From: plug-bounces@lists.phillylinux.org > [mailto:plug-bounces@lists.phillylinux.org]On Behalf Of Mark Baker > Sent: Thursday, October 19, 2006 3:07 PM > To: 'Philadelphia Linux User's Group Discussion List' > Subject: RE: [PLUG] 'ifconfig eth0 down' on mouse/kbd being idle > > > Actually running a simple w or who command with an awk > statement would let > you see the idle time of each user on the system. > > mark > > -----Original Message----- > From: plug-bounces@lists.phillylinux.org > [mailto:plug-bounces@lists.phillylinux.org] On Behalf Of George Gallen > Sent: Thursday, October 19, 2006 2:05 PM > To: Philadelphia Linux User's Group Discussion List > Subject: RE: [PLUG] 'ifconfig eth0 down' on mouse/kbd being idle > > What if you set the BIOS to use power management, > and include the ethernet (if onboard) for shutdown on sleep? > > > -----Original Message----- > > From: plug-bounces@lists.phillylinux.org > > [mailto:plug-bounces@lists.phillylinux.org]On Behalf Of > > jadoba@jadoba.net > > Sent: Thursday, October 19, 2006 1:59 PM > > To: plug@lists.phillylinux.org > > Subject: [PLUG] 'ifconfig eth0 down' on mouse/kbd being idle > > > > > > 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. > > > > I can only guess it can be done by monitoring /dev/input/mouse0 and > > /dev/input/event1 (which seems to be my mouse and keyboard device > > files, respectively) but don't know whether it is possible > in a simple > > shell script, or if I'd have to use perl (which I never learned). > > Aside from cat, I don't know how to monitor a device file for > > activity. > > > > My most obvious question is, has anyone done this before, or has > > anyone heard of this being done and can they link me to the code? > > Otherwise, can anyone give me a quick outline of what commands a > > script like that should contain (namely, how to monitor the device > > files from within a script, how to set a timer for the > activity, how > > to hav it run ifconfig at the correct time, and how to trigger > > ifconfig again when activity is reported back to the script) > > > > thanks > > > > -jim > > > > ______________________________________________________________ > > _____________ > > 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 > > > ______________________________________________________________ > _____________ > 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 > > ______________________________________________________________ > _____________ > 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 > ___________________________________________________________________________ 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
|
|