Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Programming & Scripting > WRT54GL Router LED Control...Script Help Needed...
 Linux Programming & Scripting   C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 02-02-2008   #1 (permalink)
Just 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
joelinkup is offline  

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run parent shell script in -x ~debug mode and all child scripts that it calls Sangal-Arun Linux Programming & Scripting 2 08-04-2007 11:26 AM
Accessing Internet -HOW?!? src2206 Redhat / Fedora Linux Help 69 08-31-2006 09:12 PM
Microphone doesn't work (so can't use Voip) Chen-Zhen Peripherals / Hardware 0 06-24-2005 04:01 PM
sound problems.... nwoods29321 Gaming / Games / Multimedia / Entertainment 1 05-04-2005 12:12 PM
pppd troubleshooting petitcolin Linux Networking 3 05-19-2004 11:25 PM

Free Magazines
Free Network Mapping Tool for Microsoft® Office Visio® Professional 2007 Users
Don't map your network by hand – let LANsurveyor Express for Microsoft Visio Professional 2007 automatically create network diagrams for you.
subscribe
Free eBook:"Vulnerability Management for Dummies"
Get all the Facts and See How to Implement a Successful Vulnerability Management Program.
subscribe
Google vs The World: The Battle of the Message Security Vendors
With such a powerful name behind it, Google Message Security stands out in a sea of products that do exactly the same thing - or so they say.
subscribe

Safe, Secure Backup


All times are GMT. The time now is 08:42 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2