diff options
Diffstat (limited to 'frontends/scripts')
| -rw-r--r-- | frontends/scripts/dns-failover.ksh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/frontends/scripts/dns-failover.ksh b/frontends/scripts/dns-failover.ksh index 4042ee3..6566a5e 100644 --- a/frontends/scripts/dns-failover.ksh +++ b/frontends/scripts/dns-failover.ksh @@ -18,6 +18,21 @@ determine_master_and_standby () { standby=$tmp fi + local -i health_ok=1 + if ! ftp -4 -o - https://$master/index.txt | grep "Welcome to $master"; then + echo "https://$master IPv4 health check failed" + health_ok=0 + elif ! ftp -6 -o - https://$master/index.txt | grep "Welcome to $master"; then + echo "https://$master IPv6 health check failed" + health_ok=0 + fi + + if [ $health_ok -eq 0 ]; then + local tmp=$master + master=$standby + standby=$tmp + fi + echo "Master is $master, standby is $standby" MASTER_A=$(host $master | awk '/has address/ { print $(NF) }') |
