Page 1 of 1

help needed with script that fails to work

Posted: Sun Jan 08, 2006 10:15 pm
by mike.tio
Can any show me where this is going wrong?

1.1.1.1 is second hop on a sat link & I want to disable the default route when it starts loosing packets. The first hop is the Sat router that I can't query to see if the link is up.

10.10.1.2 is the far end of a wireless backhaul (/29) to another mikrotik box with a gateway to use if Sat link fails.

There is a backup default route to 10.10.1.2 injected by OSPF.

Thanks
Mike

:while true do={
:delay 60s
:if ([/ping 1.1.1.1 count=5] < 4) do {
:if ([/ping 10.10.1.2 count=5] = 5) do {
/ip route disable [ /ip route find comment=sat-link]
:log info "Sat-Link next hop dropping packets"
:log info "Backhaul Ready For Default Route"
:log info [ /tool e-mail send server 2.2.2.2 to=support@address.com /
subject="Removed Sat-Link Route - on Backhaul" ]
} else={
:log info "Sat-Link next hop dropping packets"
:log info "Backhaul Not Ready For Default Route keep sat-link"
:log info [ /tool e-mail send server 2.2.2.2 to=support@address.dom /
subject="Sat-Link Failed - Backhaul Not Ready" ]
}
} else={
/ip route enable [ /ip route find comment=sat-link]
:log info "Sat-Link Default OK or Restored"
}
}