From: Ian Kelling Date: Sat, 14 Feb 2026 15:04:56 +0000 (-0500) Subject: better output for dynamic ip update failures X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=89c7112b03855d7c226c54146b512967dab3e5a9;p=distro-setup better output for dynamic ip update failures --- diff --git a/dynamic-ip-update b/dynamic-ip-update index f72ee0e..1238451 100755 --- a/dynamic-ip-update +++ b/dynamic-ip-update @@ -20,8 +20,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - -set -e; . /usr/local/lib/bash-bear; set +e +. /a/c/fsf-script-lib [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" this_file="$(readlink -f -- "${BASH_SOURCE[0]}")" @@ -161,8 +160,8 @@ main() { fi # if we failed to get our ipv6 addr, we probably have ipv6 - # connectivity problem. - if [[ ! $ip6 ]]; then + # connectivity problem. But also just vary to ipv4 if we are failing. + if [[ ! $ip6 ]] || (( nsupdate_fails % 3 )); then ip_arg=-4 fi @@ -209,11 +208,25 @@ answer quit EOF - if $verbose; then echo "nsupdate stdin:"; cat $tmpf; fi - chronic nsupdate $ip_arg -k /p/c/user-specific/bind/etc/bind/Kb8.nz.*.private <$tmpf || nsupdate_fails=$((nsupdate_fails + 1)) + nsupdate_fails_start=$nsupdate_fails + if ! mb chronic nsupdate $ip_arg -k /p/c/user-specific/bind/etc/bind/Kb8.nz.*.private <$tmpf; then + echo "nsupdate stdin:"; cat $tmpf + nsupdate_fails=$((nsupdate_fails + 1)) + elif $verbose; then + echo "nsupdate stdin:"; cat $tmpf + fi sed -i 's/^server .*/server bk.b8.nz/' $tmpf - if $verbose; then echo "nsupdate stdin:"; cat $tmpf; fi - chronic nsupdate $ip_arg -k /p/c/user-specific/bind/etc/bind/Kb8.nz.*.private <$tmpf || nsupdate_fails=$((nsupdate_fails + 1)) + if ! chronic nsupdate $ip_arg -k /p/c/user-specific/bind/etc/bind/Kb8.nz.*.private <$tmpf; then + echo "nsupdate stdin:"; cat $tmpf + nsupdate_fails=$((nsupdate_fails + 1)) + elif $verbose; then + echo "nsupdate stdin:"; cat $tmpf + fi + + if (( nsupdate_fails_start == nsupdate_fails )); then + nsupdate_fails=0 + fi + if (( nsupdate_fails > nsupdate_fail_limit )); then echo error: nsupdate is persistently failing >&2 exit 1 @@ -230,7 +243,7 @@ loop-main() { nsupdate_fails=0 if [[ $PPID == 1 ]]; then - nsupdate_fail_limit=10 + nsupdate_fail_limit=20 loop-main else nsupdate_fail_limit=0