Results 1 to 1 of 1
I cannot get this script to run...Could you Please help...I am just a very beginner so I will need direct assistance to be of any value...I Thank You for any ...
- 02-02-2008 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 1
WRT54GL Router LED Control...Script Help Needed...
I cannot get this script to run...Could you Please help...I am just a very beginner so I will need direct assistance to be of any value...I Thank You for any attempt you make...There may be just a loop error or even a syntax error...I don't know...Thanks again...
Project Description: Bash Linux Script...WRT54GL Router...LED Control...
3 print servers will be Totally Ignored.
A Blinking Amber Cisco LED will indicate that 1 or more of 4 cameras are accessing the router while nothing else is.
A Steady Amber Cisco LED will indicate that a client other than or in addition to a camera is accessing the router.
A Steady White Cisco LED will indicate there is activity by these other clients.
A Dark Cisco LED will indicate that no client is accessing the router.
------------------------------------------------------------------------
Code:### Define Variables ### clientpresent="amber on" clientactive="white on" ledsoff="amber off white off" I=`nvram get wl0_ifname` #Start the loop while sleep 1 ; do ## Initialize ## seecameras="" clientsminusprinters="" blinkamber="" clientleds="" ### Define Functions ### #look for camera macs seecameras () { if [ [ wl assoclist | grep A1:B1:C1:D1:E1:F1 || wl assoclist | grep A2:B2:C2:D2:E2:F2 || wl assoclist | grep A3:B3:C3:D3:E3:F3 ] ]; then return 0 # true else return 1 # false fi } #look for clients other than printer macs clientsminusprinters () { ignoredmacs=$(wl assoclist | grep -v A1:B1:C1:D1:E1:F1 | grep -v A2:B2:C2:D2:E2:F2 | grep -v A3:B3:C3:D3:E3:F3) if [ -n "ignoredmacs" ] ; then return 0 # true else return 1 # false fi } #blink amber led function blinkamber () { led amber off sleep 1 led amber on } #client present leds clientleds () { XFER=`ifconfig $I|grep bytes` if [ "$XFER" != "$PXFER" ]; then LED=$clientactive PXFER=$XFER else LED=$clientpresent fi if [ "$LED" != "$PLED" ]; then led $LED PLED=$LED fi } ### MAIN ### if [ [ seecameras && clientsminusprinters == 1 ] ]; then blinkamber elif [ [ clientsminusprinters && seecameras ] ]; then clientleds else #default command led $ledsoff fi done


Reply With Quote
