reboot script

Discussion in 'Tomato Firmware' started by Low-WRT, Jan 4, 2013.

  1. Low-WRT

    Low-WRT LI Guru Member


    I have a Asus Rt-N16 running tomatousb as a wireless ethernet bridge.
    Everyday or so, it messes up and is not connected to the ap. I usually just reboot it and it works.
    I searched and found this script:

    /bin/ping -c 1 > /dev/null; if [[ $? != 0 ]]; then /sbin/reboot; fi
    I put this in the custom scheduler and set it to run every 30 min.
    Is this the best way to do this?

  2. fubdap

    fubdap LI Guru Member

    Tomato already has reboot built-in. Go to Administration, go to scheduler and you will see the image below. Pick the day and time and save.

  3. Goggy

    Goggy Network Guru Member

  4. Elfew

    Elfew Network Guru Member

    So which script should I use for autoreconnect when the connection to the main router is off?
  5. Monk E. Boy

    Monk E. Boy Network Guru Member

    Oh god. There used to be an awesome script in here that got lost when the board was wiped and restored from backup. :( Sorry, I wish I had saved it.
  6. kthaddock

    kthaddock Network Guru Member

    You mean this script:
    if [ "$1" != "" ]; then
    if [ "$2" != "" ]; then
    ploss=`ping -q -w$pingtime $trip | grep -o "[0-9]*%" | tr -d %` > /dev/null 2>&1
    if [ "$ploss" -gt "$maxPloss" ]; then
          logger No response from $trip - rebooting...
    exit 0

    Attached Files:

    • p.txt
      File size:
      365 bytes
  7. Elfew

    Elfew Network Guru Member

    So this script does what I need? Reconnect/reboot router everytime when the internet connection is offline? Thank you..

    and one more thing - it reboots again and again until the internet connection will be ON? Thank you again
  8. zorkmta

    zorkmta Network Guru Member

    where should put this scritps? On Admintration- Scripts- (INIT or Shutdown or firewall or WAN UP)?'?
  9. Monk E. Boy

    Monk E. Boy Network Guru Member

    I believe you would want to create a shell script on a writable folder (JFFS, or a CIFS share, or a USB device), then call that script under Custom 1 on a fixed schedule.

    I sort of remember someone adding some nice logic to determine if the WAN interface came up, then it would run 24/7 in the background once the WAN came up, so you could put it in either Init or Firewall.

    The posted script just runs once and reboots if the ping fails or is too high, which is great and perfectly useful, its just not as awesome as I remember.
  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