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

Auto Reconnect every 20 minutes (script)

Discussion in 'Tomato Firmware' started by SteelRAT, Jul 6, 2007.

  1. SteelRAT

    SteelRAT Network Guru Member

    Hallo,
    I am looking for a script that will make my router reconnect to my provider every 20 minutes. Can anybody help me?

    Thanks,
    SteelRAT
     
  2. ntest7

    ntest7 Network Guru Member

    What's it take to reconnect to your provider? Just some web activity? Try this for an init script (Administration->Scripts/ Init):

    while true ; do /bin/sleep 1200
    /usr/bin/wget -O - http://google.com > /dev/null
    done

    Or some other smallish web site. The google page is currently about 5k.
    You might could use "/bin/ping -c 1 google.com > /dev/null" instead of the wget command, but some dialers ignore ping.
     
  3. yaqui

    yaqui LI Guru Member

    Try this... place the script under init and reboot your router... every 20 minutes it should shut down connection for 5 minutes (to avoid creating a virtual connection) then reconnect:

    sleep 5
    echo -e "#!/bin/sh\n while true \; do sleep 1200" > /tmp/wanrestart.sh
    echo -e "service wan stop" >> /tmp/wanrestart.sh
    echo -e "logger \'wan stop success\'" >> /tmp/wanrestart.sh
    echo -e "sleep 300" >> /tmp/wanrestart.sh
    echo -e "service wan start" >> /tmp/wanrestart.sh
    echo -e "logger \'wan restart successful\'" >> /tmp/wanrestart.sh
    echo -e "done" >> /tmp/wanrestart.sh
    chmod 755 /tmp/wanrestart.sh
    /tmp/wanrestart.sh

    Let me know if that works !
     
  4. yaqui

    yaqui LI Guru Member

    Does my script work ? :/
     

Share This Page