Better waiting for record updating.
This commit is contained in:
parent
d5254e5e8f
commit
31998074fa
2 changed files with 10 additions and 6 deletions
10
certbot-auth
10
certbot-auth
|
@ -1,9 +1,15 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -x
|
||||
echo "certbot txt record: $CERTBOT_VALIDATION" >&2
|
||||
|
||||
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=%s'
|
||||
result="$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$CERTBOT_VALIDATION" | curl -K -)"
|
||||
|
||||
# give some time for the record to update
|
||||
sleep 300
|
||||
echo "waiting for txt record" >&2
|
||||
for i in $(seq 0 60); do
|
||||
val="$(dig -t txt redxef2.duckdns.org | grep -A 1 ';; ANSWER SECTION:' | tail -n1 | sed -n 's/.*"\([^"]*\)".*/\1/p')"
|
||||
test "$val" = "$CERTBOT_VALIDATION" && break
|
||||
sleep 10
|
||||
done
|
||||
test "$result" = 'OK'
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -x
|
||||
|
||||
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=&clear=True%s'
|
||||
test "$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$CERTBOT_VALIDATION" | curl -K -)" = 'OK'
|
||||
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=&clear=True'
|
||||
test "$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" | curl -K -)" = 'OK'
|
||||
|
|
Loading…
Reference in a new issue