Script to enable 1 ether and disbale another

Hi i need a script maybe someone can help me. Scenario main router at upstream provider with 2 layer2 wireless links running to my main tower and into a RB 1000. On the RB1000 ether1 is plugged into the main microwave link and ether3 into the redundant microwave link. Both ether1 and ether3 have the same ip to accept routes from the main router so the main router is the 1 and only gateway.

So what i would like is a script that pings the upstream provider dns and if looses connection for more than 15s then disable ether1 and enable ether3 if ether1 starts pinging again disable ether3 and re enable ether1.

New to scripts on Mikrotik so any help appreciated.

you have several choices in this scenario (not in order of relevance):
1st - script that pings and disables or enables interface
2nd - use of netwatch to do certain things on up/down events. What is option #1 but with some pre-made parts
3rd - use of OSPF, that will adjust routes automatically
4th - routes with check gateway set.

you can look up examples in forums.