1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

simplify a wireless script

Discussion in 'Tomato Firmware' started by Low-WRT, Sep 26, 2007.

  1. Low-WRT

    Low-WRT LI Guru Member

    How can I simplify this script? All I want it to do is be white when my laptop is connected and orange when it's not. I works how I have it, but it has that extra step of changing color when data is being transmitted, which I'd like to remove...I tried but I can't get it to work.

    I=`nvram get wl0_ifname`
    while sleep 1; do
    minusbridge=$(wl assoclist | grep -v 00:18:84:13:4E:79)
    if [ -n "$minusbridge" ] ; then
    XFER=`ifconfig $I|grep bytes`
    if [ "$XFER" != "$PXFER" ]; then
    LED="amber off white on"
    PXFER=$XFER
    else
    LED="amber off white on"
    fi
    else
    LED="amber on white off"
    fi
    if [ "$LED" != "$PLED" ]; then
    led $LED
    PLED=$LED
    fi
    done
     
  2. yaqui

    yaqui LI Guru Member

    Code:
    while sleep 1; do
    minusbridge=$(wl assoclist | grep -v 00:18:84:13:4E:79)
    if [ -n "$minusbridge" ] ; then
    led amber off white on
    else
    led amber on white off
    fi
    done
     
  3. Low-WRT

    Low-WRT LI Guru Member

    Perfect!
    Thanks yaqui. You always help with scripts. Thanks a lot.
     
  4. mstombs

    mstombs Network Guru Member

    Do you really need to know every second whether you are connected? I'd have thought you could increase that sleep to 10 or 20 seconds at least to reduce load on the poor little router!
     
  5. yaqui

    yaqui LI Guru Member

    Yeah, I agree with mstombs... I usually just set it up as a cron to check ~ every 1 minute
     
  6. Low-WRT

    Low-WRT LI Guru Member

    Good call...I'll change it to 60 sec...thanks
     

Share This Page