update.sh: ddns sleep for random seconds to avoid burst

This commit is contained in:
xiongdian.me 2023-05-15 11:42:09 +08:00
parent 8eb2088331
commit 8f3b053bbd

View File

@ -13,6 +13,11 @@ apost_beacon "sys.online"
# update dns # update dns
if [[ "$DFS_DDNS_ENABLE" == "1" ]]; then if [[ "$DFS_DDNS_ENABLE" == "1" ]]; then
fmt_info "updating dns ..." fmt_info "updating dns ..."
if ! is_tty; then
time_to_sleep=$((RANDOM%600))
fmt_note "sleep for $time_to_sleep seconds"
sleep $time_to_sleep
fi
"$THIS_DIR/tools/frigg-client.sh" ddns || (fmt_error "failed to update dns" && apost_beacon "dfs.ddns.fail") "$THIS_DIR/tools/frigg-client.sh" ddns || (fmt_error "failed to update dns" && apost_beacon "dfs.ddns.fail")
fi fi