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

Loading…
Cancel
Save