13 lines
374 B
Bash
13 lines
374 B
Bash
#!/bin/sh
|
|
|
|
HEALTHCHECK_RECORD=healthcheck.unbound
|
|
EXPECTED_VALUE=127.0.0.1
|
|
|
|
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}"
|