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

WDS keepalive script

Discussion in 'Tomato Firmware' started by TexasFlood, Jun 24, 2011.

  1. TexasFlood

    TexasFlood Network Guru Member

    So. I quit using WDS a while back, basically because I couldn't keep WDS linked on a variety of different models & vintage router hardware. It was always rock solid on the same vintage hardware but not a mix.

    Recently jsmiddleton4 inspired me to start using WDS again. WDS was very stable once I got the router links synced up but it could be a pain if I rebooted the primary router, sometimes needing to resort to running around and power cycling the "remote" routers as I could not re-establish a link to the remotes no matter how many times I rebooted or restarted services on the primary router.

    Anyway, pulled out my notes on scripts that never seemed to quite work right before. I probably re-entered them slightly differently than before or perhaps Toastmans latest firmware which I'm using is slightly different. Whichever, seems working for me now so I thought I'd share for anyone experiencing the same issue.

    They all ping each other every 5 minutes and reboot if it fails. After a few tests mine are resyncing reliably quickly now. Yay, trouble free WDS again. :biggrin: I know it's very simple but hey it works for me, maybe will for someone else as well.

    So in this example, 192.168.1.1 is my primary WAN router and the remotes are 192.168.1.{2-4}. Oh, and of course the scripts doesn't write out to /tmp and set up the cron schedule until the first boot after the script is saved to the Init tab.

    Init tab on my primary WAN router that all others link to, 3 in this case.
    Code:
    cat <<END > /tmp/keepalive
    ping -c3 192.168.1.2 >/dev/null || reboot
    ping -c3 192.168.1.3 >/dev/null || reboot
    ping -c3 192.168.1.4 >/dev/null || reboot
    END
    chmod 755 /tmp/keepalive
    cru a keepalive "*/5 * * * * /tmp/keepalive >/dev/null 2>&1"
    Init tab on each remote router.
    Code:
    cat <<END > /tmp/keepalive
    ping -c3 192.168.1.1 >/dev/null || reboot
    END
    chmod 755 /tmp/keepalive
    cru a keepalive "*/5 * * * * /tmp/keepalive >/dev/null 2>&1"
     
  2. Goggy

    Goggy Network Guru Member

    Hmm - interesting :D Question to be sure: i disable WLan via Scheduler from 0:30 - 06:00. So when i use this Script the Router's would reboot every 5 Minutes in this Timeframe?
    Is there a Possibility to disable the Script when WLan is off?

    Thx!
     
  3. Goggy

    Goggy Network Guru Member

    Nevermind - first think than write ;-)
    cru a keepalive "*/5 6-23 * * * /tmp/keepalive >/dev/null 2>&1" does the Job ..

    A Linux - Noob :D
     
  4. jsmiddleton4

    jsmiddleton4 Network Guru Member

    Texas has way more routers in his system than I. I currently have 2, did have 3. Once WDS is connected I've never had to routinely reboot the routers to keep connected, once connected they've stayed connected. Again my WDS environment very different than Texas...
     
  5. TexasFlood

    TexasFlood Network Guru Member

    Yes it would reboot. Off the top of my head two approaches come to mind, keep it in a cron script and come up with a more detailed cron entry listing exactly when you want it to run or take the actual ping statement that really does the work and move it over to a scheduler entry. The latter seems easier to maintain set up and maintain. I just used cron cause I'm familiar and comfortable with it but no reason it can't be a scheduler entry.

    Well, I went and tested that, pasted something like "ping -c3 {IP address that I know won't reply} >/dev/null || reboot" into scheduler custom 1. Didn't seem to be working. So I tried just putting a logger statement in and confirmed it's not working on my router. Doesn't particularly bother me since I like to use cron but I didn't realize it was broke. This is with v1.28.7476 MIPSR2-Toastman-RT K26 Std on an E2000.
     
  6. Toastman

    Toastman Super Moderator Staff Member Member

    TF - I just tested the scheduler here on 7476 K26 ext (E3000) set to restart some services at 20:00 and then to reboot at 20:30 - and at the appointed time they all worked OK. Are you saying the scheduler itself is broken, or that certain scripts don't seem to run in the entry box?
     
  7. TexasFlood

    TexasFlood Network Guru Member

    I put a script in custom 1 which didn't seem to be working so finally just put in a logger statement as a test and that didn't log either. So in my case it doesn't seem to be running the script. If it worked in your test, guess the next step for me will be to back up nvram, clear it, reload what I care about and test again.... wait....

    OK, I'm an ID-10-T.

    As I was thinking of what I needed to do to troubleshoot this, a little birdie whispered in the back of my head "Did you check the clock since cron and scheduler all depend on the clock". So I check the router I was testing this on and sure enough the clock wasn't set. It's a slave WDS router and the default gateway wasn't set. It was the only one like that, not sure how I missed that. It's hooked up to a DVR and not all that critical so guess I just wasn't paying attention. And I was working at the time and sort of testing this "on the side".

    So anyway after setting the default gateway, NTP set the time and scheduler is working now, sorry for the false report, :blush:
     
  8. Toastman

    Toastman Super Moderator Staff Member Member

    No worries, just wanted to clear that up! Keep up the good work :)
     

Share This Page