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....
    #wl default on if file doesnt exist
    if [ -f /tmp/wl.chk ]; then
    	echo 1 > /tmp/wl.chk;
    #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;
    and button toggle modified
    # 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
    echo 0 > /tmp/wl.chk
    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:

    sleep 15
    sleep 15
    sleep 15
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice