Wireguard/OpenVPN Server Failover Switching

Is it possible to add functionality in B1300 so that it case Wireguard VPN connection fails the router should connect to another server automatically? Someone suggested that in the forum through a script but how can this be achieved?

Please help.