George Gallen on 19 Oct 2006 18:04:57 -0000


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

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