Run script when a gateway fails over

Hi, I have a failover gateway configured as per this example https://wiki.mikrotik.com/wiki/Two_gateways_failover
How can I trigger my dyndns update script to run when the gateways switch between primary and secondary?

Thanks

Anyone? Surely someone has done this before.

Thanks

Based on the limited information you provided, this should be sufficient:

Create / run a script to pick up active wan IP

https://forum.mikrotik.com/viewtopic.php?f=9&t=147561

Thanks, that script looks good!
I see you have to hard code the gateway IP, my ISP provides dynamic information so it can change, is there any way to update the script to get the correct gateway from the DHCP client?

Cheers

I am waiting for the post that shows reality. Two wans, two dynamic IP addresses and one of them is not simple cable that just simply loads but it is fibre op where one has to read the IP address from the client side and then stick it into the routing rule. I can get failover to work from fibre to cable (wan1 to wan2) but it will never go back because the fibre op IP has changed and there is no way, other than manually to insert the correct wan1 gateway IP. I have a dydndns name but I would like to be able to do all of this without that and solely use the MT cloud.