only try to get ip address if necessary

master
rasul 4 years ago
parent 2cc5cf8fa3
commit 21cc43fe6b

@ -50,18 +50,22 @@ done
# shellcheck source=he-ddnsrc
. "$config" || die $LINENO
ipv4="$(curl -sSL4 "$ip_host")" || die $LINENO
for domain in "${!DOMAINS4[@]}"; do
printf "%s :: " "$domain"
key=${DOMAINS4[$domain]}
curl -sSL4 "$url" -d "hostname=$domain" -d "password=$key" -d "myip=$ipv4" || die $LINENO
echo
done
if [[ -n "${DOMAINS4[*]}" ]]; then
ipv4="$(curl -sSL4 "$ip_host")" || die $LINENO
for domain in "${!DOMAINS4[@]}"; do
printf "%s :: " "$domain"
key=${DOMAINS4[$domain]}
curl -sSL4 "$url" -d "hostname=$domain" -d "password=$key" -d "myip=$ipv4" || die $LINENO
echo
done
fi
ipv6="$(curl -sSL6 "$ip_host")" || die $LINENO
for domain in "${!DOMAINS6[@]}"; do
printf "%s :: " "$domain"
key=${DOMAINS6[$domain]}
curl -sSL6 "$url" -d "hostname=$domain" -d "password=$key" -d "myip=$ipv6" || die $LINENO
echo
done
if [[ -n "${DOMAINS6[*]}" ]]; then
ipv6="$(curl -sSL6 "$ip_host")" || die $LINENO
for domain in "${!DOMAINS6[@]}"; do
printf "%s :: " "$domain"
key=${DOMAINS6[$domain]}
curl -sSL6 "$url" -d "hostname=$domain" -d "password=$key" -d "myip=$ipv6" || die $LINENO
echo
done
fi

Loading…
Cancel
Save