diff --git a/ddns4.sh b/ddns4.sh index ecdc729..34dfc47 100755 --- a/ddns4.sh +++ b/ddns4.sh @@ -68,7 +68,12 @@ fi ############################################# echo -e "${PENDING} get Zones" HETZNER_API_ZONE=$(curl -s "https://dns.hetzner.com/api/v1/zones" -H "Auth-API-Token: ${HETZNER_API_TOKEN}" | jq -r ".zones[] | select(.name==\"$DNSZONE\") | .id") -echo -e "${REPLACE}${SUCCESS} get DNS Zone" +if [ -z $HETZNER_API_ZONE ]; then + echo -e "${REPLACE}${ERROR} get DNS Zone" + exit 1 +else + echo -e "${REPLACE}${SUCCESS} get DNS Zone" +fi ############################################# echo -e "${PENDING} Check DNS Console for existing records" RECORDS=$(curl -s "https://dns.hetzner.com/api/v1/records?zone_id=${HETZNER_API_ZONE}" \ diff --git a/ddns6.sh b/ddns6.sh index 4aa08e2..65f6dee 100755 --- a/ddns6.sh +++ b/ddns6.sh @@ -68,7 +68,12 @@ fi ############################################# echo -e "${PENDING} get Zones" HETZNER_API_ZONE=$(curl -s "https://dns.hetzner.com/api/v1/zones" -H "Auth-API-Token: ${HETZNER_API_TOKEN}" | jq -r ".zones[] | select(.name==\"$DNSZONE\") | .id") -echo -e "${REPLACE}${SUCCESS} get DNS Zone" +if [ -z $HETZNER_API_ZONE ]; then + echo -e "${REPLACE}${ERROR} get DNS Zone" + exit 1 +else + echo -e "${REPLACE}${SUCCESS} get DNS Zone" +fi ############################################# echo -e "${PENDING} Check DNS Console for existing records" RECORDS=$(curl -s "https://dns.hetzner.com/api/v1/records?zone_id=${HETZNER_API_ZONE}" \