mirror of
https://github.com/aaronriedel/hetzner-ddns.git
synced 2024-11-18 08:56:41 +01:00
add error check for false or missing DNS Zone
This commit is contained in:
parent
1f609cb222
commit
9f088db3a6
2 changed files with 12 additions and 2 deletions
5
ddns4.sh
5
ddns4.sh
|
@ -68,7 +68,12 @@ fi
|
||||||
#############################################
|
#############################################
|
||||||
echo -e "${PENDING} get Zones"
|
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")
|
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")
|
||||||
|
if [ -z $HETZNER_API_ZONE ]; then
|
||||||
|
echo -e "${REPLACE}${ERROR} get DNS Zone"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
echo -e "${REPLACE}${SUCCESS} get DNS Zone"
|
echo -e "${REPLACE}${SUCCESS} get DNS Zone"
|
||||||
|
fi
|
||||||
#############################################
|
#############################################
|
||||||
echo -e "${PENDING} Check DNS Console for existing records"
|
echo -e "${PENDING} Check DNS Console for existing records"
|
||||||
RECORDS=$(curl -s "https://dns.hetzner.com/api/v1/records?zone_id=${HETZNER_API_ZONE}" \
|
RECORDS=$(curl -s "https://dns.hetzner.com/api/v1/records?zone_id=${HETZNER_API_ZONE}" \
|
||||||
|
|
5
ddns6.sh
5
ddns6.sh
|
@ -68,7 +68,12 @@ fi
|
||||||
#############################################
|
#############################################
|
||||||
echo -e "${PENDING} get Zones"
|
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")
|
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")
|
||||||
|
if [ -z $HETZNER_API_ZONE ]; then
|
||||||
|
echo -e "${REPLACE}${ERROR} get DNS Zone"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
echo -e "${REPLACE}${SUCCESS} get DNS Zone"
|
echo -e "${REPLACE}${SUCCESS} get DNS Zone"
|
||||||
|
fi
|
||||||
#############################################
|
#############################################
|
||||||
echo -e "${PENDING} Check DNS Console for existing records"
|
echo -e "${PENDING} Check DNS Console for existing records"
|
||||||
RECORDS=$(curl -s "https://dns.hetzner.com/api/v1/records?zone_id=${HETZNER_API_ZONE}" \
|
RECORDS=$(curl -s "https://dns.hetzner.com/api/v1/records?zone_id=${HETZNER_API_ZONE}" \
|
||||||
|
|
Loading…
Reference in a new issue