Ovpn script failover

Hi

I am implementing a backup radius server based on freeradius with openvpn. I do not want to add both radius servers to the mikrotiks due to timeout issues etc. The second server will just be for total failover.

What I was thinking:
We currently push a private range to each router via openvpn for PPPoE auth on the radius. We duplicate the same on the backup server, i.e two openvpn connections on each Mikrotik on the same range - however we leave the backup openvpn connection disabled. We then have one radius server setup on the mikrotik pointing towards the same common IP e.g 10.254.254.1.

Then I would implement a script to check ever 30 seconds to see if the first openvpn connection is active, if not it enables the second openvpn connection and vice versa to fail back.

I am having an issue with this script. I think it is my if statement and the second part runs if I remove the if statement. Please help?

{
if ([/interface ovpn-client radius.xxx active] = no) do={
/interface ovpn-client enable radius2.xxx;
}

Decided to use netwatch to rather monitor the IP of the main ovpn connection and the enable on down for the backup ovpn, and on up disable the second and re-enable the main.