Browse Source

Add retry logic for "Bad Gateway" duckdns error

pull/589/head
Tim Kimber 5 years ago
parent
commit
90a418801d
No known key found for this signature in database GPG Key ID: 3E1804964E76BD18
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      dns_scripts/dns_add_duckdns

+ 9
- 0
dns_scripts/dns_add_duckdns View File

@ -10,8 +10,17 @@ fi
domain="$1"
txtvalue="$2"
i=1
response=$(curl --retry 5 --silent "https://www.duckdns.org/update?domains=${domain}&token=${token}&txt=${txtvalue}")
while [[ "${response}" == *"502 Bad Gateway"* ]] && [ $i -le 5 ]; do
echo "Retrying Bad Gateway response (attempt $i of 5)"
sleep 5
i=$((i+1))
response=$(curl --retry 5 --silent "https://www.duckdns.org/update?domains=${domain}&token=${token}&txt=${txtvalue}")
done
if [ "$response" != "OK" ]; then
echo "Failed to update TXT record for ${domain} at duckdns.org (is the TOKEN valid?)"
echo "Response: $response"


Loading…
Cancel
Save