From 3bb7a0232b63202572dd7ed16010e93afa97e87e Mon Sep 17 00:00:00 2001 From: Alecander Graf Date: Sun, 13 Dec 2020 23:09:34 +0100 Subject: [PATCH] Add logging, fix indent, add additional service --- dyndns.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dyndns.sh b/dyndns.sh index eafa35a..1cd7804 100755 --- a/dyndns.sh +++ b/dyndns.sh @@ -4,6 +4,7 @@ api_host="https://api.digitalocean.com/v2" sleep_interval=${SLEEP_INTERVAL:-300} services=( + "ifconfig.co" "ipinfo.io/ip" "ifconfig.me" ) @@ -29,9 +30,10 @@ while ( true ); do echo "Trying with $service..." ip="$(curl -s $service)" - - test -n "$ip" && break + test -n "$ip" && break done + + echo "Found IP address $ip" if [[ -n $ip ]]; then for sub in ${NAME//;/ }; do @@ -51,6 +53,8 @@ while ( true ); do -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ -d "$data" \ "$url" &> /dev/null + else + echo "existing DNS record address ($record_data) did not need updating" fi done else