IP SLA similar script

Hello,

Anyone have an IP SLA similar script? I have a router with two ISPs and with two default gateway (different metric). If something happened with ISP1, for example intermediate network issues, my router is not fall back to ISP2.

Thanks & Regards
David