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

WLAN interface dieing recovery script

Discussion in 'Tomato Firmware' started by thor2002ro, May 10, 2009.

  1. thor2002ro

    thor2002ro Addicted to LI Member

    i went to a friends house and his wifi interface dies from time to time(1 day+) ... not shure why... no errors reported so i made this script

    running every minute... how can i make it run every 5-10s? for faster recovery....
    Code:
    #/bin/sh
    
    #wl default on if file doesnt exist
    if [ -f /tmp/wl.chk ]; then
    	return;
    	else
    	echo 1 > /tmp/wl.chk;
    fi
    #check for wl.chk created by wl toggle script 
    file=$(cat /tmp/wl.chk);
    if [[ $file == 1 ]];then
    		wl -a eth1 up;
    		led amber on;
    fi
    and button toggle modified
    Code:
    # status: 1: wifi on, 0: wifi off
    status=$(wl -a eth1 dump | grep associated | cut -d " " -f 2);
    # toggle wifi & amber led
    wl -a eth1 $([ $status -eq 0 ] && echo up || echo down)
    led amber $([ $status -eq 0 ] && echo on || echo off)
    
    if [[ $status = 0 ]]; then
    echo 1 > /tmp/wl.chk
    else
    echo 0 > /tmp/wl.chk
    fi
    I hope this is useful to someone
    i think i will make it default in my fw to make shure the interface doesnt die...
    edit:updated script , this works better
     
  2. Thrasher

    Thrasher Network Guru Member

    Can you repeat the routing and insert a "wait" or "sleep" command between?
    i.e. to run every 15 seconds, script to start on every minute.
    script contains:

    [routine]
    sleep 15
    [routine]
    sleep 15
    [routine]
    sleep 15
    [routine]
     

Share This Page