1
0
Fork 0
mirror of https://github.com/tunix/digitalocean-dyndns synced 2024-05-04 16:53:37 +00:00

Add logging, fix indent, add additional service

This commit is contained in:
Alecander Graf 2020-12-13 23:09:34 +01:00
parent baf12a3806
commit 3bb7a0232b
No known key found for this signature in database
GPG key ID: D40F1F367EB4BE99

View file

@ -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