From 43d20a11085c05221ebeede2db37fa16c72a9114 Mon Sep 17 00:00:00 2001 From: Aaron Riedel Date: Thu, 29 Jun 2023 16:31:10 +0200 Subject: [PATCH] Make the determination of the public IP more resilient by having a backup provider --- ddns4.sh | 3 +++ ddns6.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ddns4.sh b/ddns4.sh index 940fbf7..ab2e6fb 100755 --- a/ddns4.sh +++ b/ddns4.sh @@ -44,6 +44,9 @@ echo -e "${INFO} started $(date)" echo -e "${INFO} DNS Record will be $SUBDOMAIN_IPV4.$DNSZONE_IPV4" echo -e "${PENDING} get IP address" IPv4="$(curl -s4 https://ip.hetzner.com)" +if [[ -z $IPv4 ]]; then + IPv4="$(curl -s4 https://icanhazip.com)" +fi if [[ -z $IPv4 ]]; then echo -e "${REPLACE}${FAIL} IPv4 not found" exit 1 diff --git a/ddns6.sh b/ddns6.sh index ca1fa80..5ade751 100755 --- a/ddns6.sh +++ b/ddns6.sh @@ -44,6 +44,9 @@ echo -e "${INFO} started $(date)" echo -e "${INFO} DNS Record will be $SUBDOMAIN_IPV6.$DNSZONE_IPV6" echo -e "${PENDING} get IP address" IPv6="$(curl -s6 https://ip.hetzner.com)" +if [[ -z $IPv6 ]]; then + IPv6="$(curl -s6 https://icanhazip.com)" +fi if [[ -z $IPv6 ]]; then echo -e "${REPLACE}${FAIL} IPv6 not found" exit 1