#!/bin/bash

set -ou pipefail

function check_reachability {
    curl -g -k -s -N https://"$@":4443/status.json | grep -q '{"status":"ok"}' || return 1
}

test_v4=$(check_reachability 127.0.0.1; echo $?)
test_v6=$(check_reachability ::1; echo $?)

if [ $test_v4 -eq 0 ] || [ $test_v6 -eq 0 ]
then
    exit 0
fi
