adds config option for external nameserver

This commit is contained in:
2021-02-03 13:59:18 +01:00
parent bd3056f399
commit c5de4f9e42

View File

@@ -1,5 +1,12 @@
#!/bin/bash #!/bin/bash
# The DNS-server IP to use for checking the domain->IP mapping
# If the local system has it's own DNS server which maps IPs differently
# this should point to an external DNS like 1.1.1.1
NAMESERVER="1.1.1.1"
# ----- END CONFIG -------------------------------
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
DOMAIN="$1" DOMAIN="$1"
@@ -20,7 +27,7 @@ if [[ "${PROBE_DOMAIN}" == \*.* ]]; then
PROBE_DOMAIN="probe.${PROBE_DOMAIN:2}" PROBE_DOMAIN="probe.${PROBE_DOMAIN:2}"
echo "Probe domain is ----------> ${PROBE_DOMAIN}" echo "Probe domain is ----------> ${PROBE_DOMAIN}"
fi fi
DNS_IP=$(dig +short ${PROBE_DOMAIN}) DNS_IP=$(dig @${NAMESERVER} +short ${PROBE_DOMAIN})
echo "Current DNS-IP -----------> ${DNS_IP}" echo "Current DNS-IP -----------> ${DNS_IP}"