unbound/healthcheck.sh

13 lines
381 B
Bash
Raw Normal View History

#!/bin/sh
HEALTHCHECK_RECORD=healthcheck-record.gkcld
EXPECTED_VALUE=10.10.10.10
RESOLVED_IP=$(nslookup "${HEALTHCHECK_RECORD}" 127.0.0.1 | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
if [ "${RESOLVED_IP}" != "${EXPECTED_VALUE}" ]; then
echo "[ERR] ${HEALTHCHECK_RECORD} lookup failed"
exit 1
fi
echo "[OK] ${HEALTHCHECK_RECORD} == ${RESOLVED_IP}"