What's new

Can someone help with this code...

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ComputerSteve

Senior Member
I am trying to make a wanevent with this inside it:
#!/bin/sh
wstate1=$(nvram get wan1_state_t)
if [ "$wstate1" -eq 2 ]; then
sleep 30
service stop_wan
sleep 30
service start_wan
fi

I KEEP GETTING THIS ERROR?

./wan-event: line 9: syntax error: unexpected end of file (expecting "fi")
 
Copy and paste the actual code into a code box (from the reply menu).
 
Copy and paste the actual code into a code box (from the reply menu).
Do you know if this would even accomplish what I want? I want it to be that wan1 goes back to cold standby after wan0 reconnects.. The only way I can accomplish this is by manually toggling internet. I want a script to do that meaning when wan1 changes from primary wan and goes to hot standby with an ip.. I want the ip to say renewing and not get an ip till wan1 is actually needed because wan0 lost internet and wan1 is primary again. I tried adding in nat-start service restart_wan but that just makes a perpetual loop. I also tried changing that to service stop_wan and then adding on the next line service start_wan but that just makes a perpetual loop... I appreciate your help.
 
Do you know if this would even accomplish what I want? I want it to be that wan1 goes back to cold standby after wan0 reconnects.. The only way I can accomplish this is by manually toggling internet. I want a script to do that meaning when wan1 changes from primary wan and goes to hot standby with an ip.. I want the ip to say renewing and not get an ip till wan1 is actually needed because wan0 lost internet and wan1 is primary again. I tried adding in nat-start service restart_wan but that just makes a perpetual loop. I also tried changing that to service stop_wan and then adding on the next line service start_wan but that just makes a perpetual loop... I appreciate your help.
I suggest you keep this discussion to your other thread rather than cross posting it here.
 
I would have done that but it seems only people are answering on this post !
That's because L&LD and myself were responding to this thread's question. Maybe like me, other people have read your other thread but didn't have an answer for you.
 
Works for me. Check the editor you're using.

Looks ok here as well...

wanstate.png


Could be the editor being used...
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top