aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-07-09 14:54:21 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-07-09 14:54:21 +0300
commitcb0b5ab211502ae9ec6ec816455285ec6603f7fb (patch)
treec060be5970d9fecaacf8bafc6b675d81d940f3a1
parentb062211887bda338f14cb663c2b3392a52d0df88 (diff)
Improve script
-rw-r--r--templates/usr_local_bin_do_dyndns.sh.j24
1 files changed, 2 insertions, 2 deletions
diff --git a/templates/usr_local_bin_do_dyndns.sh.j2 b/templates/usr_local_bin_do_dyndns.sh.j2
index 8579ff3..1b080b7 100644
--- a/templates/usr_local_bin_do_dyndns.sh.j2
+++ b/templates/usr_local_bin_do_dyndns.sh.j2
@@ -21,7 +21,7 @@ while :; do
IP4=$(ifconfig "$IF4" | awk '/inet / { print $2 }' | head -n1)
DIGITALOCEAN_TOKEN=$(awk '{$1=$1; print}' "$DO_DYNDNS_AUTH_FILE")
- echo "[INFO] Updating A record for $DOMAIN → $IP4"
+ echo "[INFO] Updating A record for hostname $HOSTNAME in domain $DOMAIN → $IP4"
RECORD_ID=$(curl -s -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
"https://api.digitalocean.com/v2/domains/$DOMAIN/records?per_page=999999" |
@@ -32,7 +32,7 @@ while :; do
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"data\":\"$IP4\"}" \
- "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$RECORD_ID"
+ "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$RECORD_ID" > /dev/null
echo "[INFO] Record $RECORD_ID updated"
else
echo "[WARN] No A record found for hostname \"$HOSTNAME\" in domain \"$DOMAIN\". Skipping."