i'm sorry but i can understand why my script generate an error...
i would check my WAN status and write a simple script that works
i created 3 netwatch and put this on scheduler every 15 sec
Code: Select all
:local var1 [:put ([/tool netwatch print as-value where host=8.8.8.8]->0->"status");];
:local var2 [:put ([/tool netwatch print as-value where host=1.1.1.1]->0->"status");];
:local var3 [:put ([/tool netwatch print as-value where host=208.67.220.220]->0->"status");];
:if (($var1 = "down") && ($var2 = "down") && ($var3 = "down")) do={
:log error "WAN1 DOWN"
/ip route disable [/ip route find comment="WAN1"];
/ip firewall connection remove [find] ;
} else={
/ip route enable [/ip route find comment="WAN1"];
}
so i try to elaborate this script, with
Code: Select all
:local var1 [:put ([/tool netwatch print as-value where host=8.8.8.8]->0->"status");];
:local var2 [:put ([/tool netwatch print as-value where host=1.1.1.1]->0->"status");];
:local var3 [:put ([/tool netwatch print as-value where host=208.67.220.220]->0->"status");];
:if (($var1 = "down") && ($var2 = "down") && ($var3 = "down")) do={
:log error "WAN1 DOWN"
/ip route disable [/ip route find comment="WAN1"];
/ip firewall connection remove [find] ;
} else={
#:log info "WAN1 UP"
:local routewan1 [:put [/ip/route/get value-name=active [find comment="WAN1"]]];
:if ($routewan1 = "true") do ={
# nothing
} else={
/ip route enable [/ip route find comment="WAN1"];
/ip firewall connection remove [find] ;
}
}
so i create a script and run in terminal
/system/script/run aaa
expected closing brace (line 18 column 1)
ROS 7.13.5 on RB4011...
i try for hours before posting but i can't find my error...
thank you in advance