From a51e2e9cceeffbe2fac5412933bf290741be441c Mon Sep 17 00:00:00 2001 From: napnap75 Date: Thu, 19 Oct 2023 21:37:55 +0200 Subject: [PATCH] Corrected the OVH updater --- dnsupdater/dnsupdater.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dnsupdater/dnsupdater.sh b/dnsupdater/dnsupdater.sh index 546da99..c4983fa 100755 --- a/dnsupdater/dnsupdater.sh +++ b/dnsupdater/dnsupdater.sh @@ -9,7 +9,8 @@ while true ; do if [[ "$GANDI_API_KEY" != "" ]] ; then current_ip=$(curl -s -H"X-Api-Key: $GANDI_API_KEY" https://dns.api.gandi.net/api/v5/domains/$DNS_DOMAIN/records | jq -r '.[] | select(.rrset_name == "'$DNS_HOST'") | select(.rrset_type == "A") | .rrset_values[0]') elif [[ "$OVH_USERNAME" != "" ]] ; then - current_ip=$(dig +short @dns13.ovh.net $DNS_HOST.$DNS_DOMAIN) + master_server=$(dig +short -t NS $DNS_DOMAIN | head -n 1) + current_ip=$(dig +short @$master_server $DNS_HOST.$DNS_DOMAIN) fi # Check if both IP addresses are correct @@ -24,7 +25,7 @@ while true ; do curl -s -X PUT -H "Content-Type: application/json" -H "X-Api-Key: $GANDI_API_KEY" -d '{"rrset_ttl": '$current_ttl', "rrset_values":["'$my_ip'"]}' https://dns.api.gandi.net/api/v5/domains/$DNS_DOMAIN/records/$DNS_HOST/A result=$? elif [[ "$OVH_USERNAME" != "" ]] ; then - curl --user "$OVH_USERNAME:$OVH_PASSWORD" "http://www.ovh.com/nic/update?system=dyndns&hostname=$DNS_HOST.$DNS_DOMAIN&myip=$my_ip" + curl -s --user "$OVH_USERNAME:$OVH_PASSWORD" "http://www.ovh.com/nic/update?system=dyndns&hostname=$DNS_HOST.$DNS_DOMAIN&myip=$my_ip" result=$? fi