diff options
author | Tianling Shen <cnsztl@immortalwrt.org> | 2022-12-13 03:59:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-13 03:59:46 +0800 |
commit | f7b73bf000b18835d5fa185fa261471b7af830ae (patch) | |
tree | fb8dd93f0bff3c1feda45526f0c891d19f631849 /net | |
parent | c933a15cebe43e6d35d59281a5414438cd3c1455 (diff) | |
parent | cefe85250ccfd7e3c9872d714e913ca2162ccbf4 (diff) |
Merge pull request #19982 from golddranks/master
ddns-scripts: update_gandi_net: improve logging & add timeout
Diffstat (limited to 'net')
-rw-r--r-- | net/ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh b/net/ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh index 8953072e4..321687d70 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/update_gandi_net.sh @@ -20,14 +20,23 @@ json_add_array rrset_values json_add_string "" "$__IP" json_close_array +# Log the curl command +write_log 7 "curl -s -X PUT \"$__ENDPOINT/domains/$domain/records/$username/$__RRTYPE\" \ + -H \"Authorization: Apikey $password\" \ + -H \"Content-Type: application/json\" \ + -d \"$(json_dump)\" \ + --connect-timeout 30" + __STATUS=$(curl -s -X PUT "$__ENDPOINT/domains/$domain/records/$username/$__RRTYPE" \ -H "Authorization: Apikey $password" \ -H "Content-Type: application/json" \ -d "$(json_dump)" \ + --connect-timeout 30 \ -w "%{http_code}\n" -o $DATFILE 2>$ERRFILE) -if [ $? -ne 0 ]; then - write_log 14 "Curl failed: $(cat $ERRFILE)" +local __ERRNO=$? +if [ $__ERRNO -ne 0 ]; then + write_log 14 "Curl failed with $__ERRNO: $(cat $ERRFILE)" return 1 elif [ -z $__STATUS ] || [ $__STATUS != 201 ]; then write_log 14 "LiveDNS failed: $__STATUS \ngandi.net answered: $(cat $DATFILE)" |