Proxy switch

hello everybody i wonder if anyone can write a script to switch between 2 parents proxy servers.
ex: i have 2 parent proxy “192.168.1.1” and “192.168.60.1” port “8080” so sometimes one of this proxy stop so i need a script to check every 5 second if this proxy stoped so directly change my parent proxy to the other one.
lot of thanks in advance.

Use ‘tool netwatch’.

This is quite simple script:

#get current proxy
:global gCurrentProxy [/ip proxy get parent-proxy ];

# check if current proxy is reachable
:if ([/ping $gCurrentProxy count=3] != 0) do={ 
    :if ( $gCurrentProxy = 192.168.1.1 ) do={
        /ip proxy set parent-proxy=192.168.60.1; 
    } else={
        /ip proxy set parent-proxy=192.168.1.1;
    } 
}

Add it to system scheduler, but don’t run it every 5 seconds. I think 30 sec is enough.

are you sure “else” should set something? can’t it just exit if the proxy is up?

my programming skills arent that good but i think its ok.
if ParentProxy is unreachable then it checks which is current.
If 192.168.1.1 is Parent then it changes it for 192.168.60.1
and if not then it changes to 192.168.1.1.
And if its reachable then it does nothing.

But i may be wrong :wink:

that’s right :slight_smile: