fix multiple IP addresses popping out from curl

pull/11/head
cindrmon 4 years ago
parent cc7bcfd186
commit 60ed587fe8
No known key found for this signature in database
GPG Key ID: C73973DF84F26190
  1. 11
      cloudflare-template.sh

@ -21,8 +21,17 @@ public_ip_sources=(
"https://dynamicdns.park-your-domain.com/getip" "https://dynamicdns.park-your-domain.com/getip"
) )
ip=$(curl -s ${public_ip_sources[@]}) ## Checks each Source/API for an IP and returns only one
for src in "${public_ip_sources[@]}"; do
ip=$(curl -s $src)
if [[ $ip == "" ]]; then
continue # continues checking for IP for each ip source till there is none
else
break # if IP is found, break the loop
fi
done
## If no IP is still found
if [[ $ip == "" ]]; then if [[ $ip == "" ]]; then
logger -s "DDNS Updater: No public IP found" logger -s "DDNS Updater: No public IP found"
exit 1 exit 1

Loading…
Cancel
Save