From: Ian Kelling Date: Sat, 14 Feb 2026 14:42:25 +0000 (-0500) Subject: minor improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=e2b8d2cbbbd80535248412b970fd75f07c327fbd;p=distro-setup minor improvements --- diff --git a/dynamic-ip-update b/dynamic-ip-update index b18b1bb..f72ee0e 100755 --- a/dynamic-ip-update +++ b/dynamic-ip-update @@ -36,6 +36,7 @@ Usage: ${0##*/} [-f] Update ip in remote nameserver. -f Force update even if ip hasn't changed. +-v Verbose mode. -h|--help Print help and exit. Note: Uses util-linux getopt option parsing: spaces between args and @@ -50,12 +51,14 @@ EOF ret=0; getopt -T || ret=$? [[ $ret == 4 ]] || { echo "Install util-linux for enhanced getopt" >&2; exit 1; } +verbose=false force=false # default -temp=$(getopt -l help hf "$@") || usage 1 +temp=$(getopt -l help hfv "$@") || usage 1 eval set -- "$temp" while true; do case $1 in -f) force=true ;; + -v) verbose=true ;; --) shift; break ;; *) echo "$0: unexpected args: $*" >&2 ; usage 1 ;; esac @@ -70,7 +73,7 @@ main() { domaintmp=${fqdn#*.} hostnametmp=${fqdn%%.*} # i for internet - fqdn=${hostnametmp}i.${domaintmp} + fqdn6=${hostnametmp}i6.${domaintmp} up4=false @@ -134,7 +137,7 @@ main() { fi # may not be set yet so allow fail - cur6="$(host -4 -t aaaa $fqdn iankelling.org | sed -rn 's/.*has IPv6 address (.*)/\1/p;T;q')" ||: + cur6="$(host -4 -t aaaa $fqdn6 iankelling.org | sed -rn 's/.*has IPv6 address (.*)/\1/p;T;q')" ||: up6=false @@ -189,12 +192,12 @@ EOF if $up6; then if [[ $ip6 ]]; then cat >>$tmpf <>$tmpf < nsupdate_fail_limit )); then echo error: nsupdate is persistently failing >&2 diff --git a/mailtest-check b/mailtest-check index c08062b..f416acd 100755 --- a/mailtest-check +++ b/mailtest-check @@ -73,41 +73,6 @@ ssh-lan() { } -maybe-toggle-ssh() { - - # something went wrong in this case. - if (( lock_check_fails >= 2 )); then - ssh-wan - fi - export DISPLAY=:0 - export XAUTHORITY=/home/iank/.Xauthority - - if ! lock_info=$(xscreensaver-command -time 2>/dev/null); then - lock_check_fails+=1 - return 0 - fi - - lock_or_unlock_time=$(echo "$lock_info" | grep -o 'since.*' | sed 's/since //') - lock_or_unlock_time=$(date -d "$lock_or_unlock_time" +%s 2>/dev/null ||:) - uint_regex='^[0-9]+$' - if [[ ! $lock_or_unlock_time =~ $uint_regex ]]; then - lock_check_fails+=1 - return 0 - fi - lock_check_fails=0 - - if [[ $lock_info == *non-blanked* ]]; then - if ! $deactivated_sshd; then - deactivated_sshd=true - ssh-lan - fi - # if its been blanked more than a few minutes while I'm afk turn ssh back on. - elif $deactivated_sshd && (( EPOCHSECONDS - lock_or_unlock_time > 60 * 2 )); then - deactivated_sshd=false - ssh-wan - fi -} - rspamc-process() { # note, this could in theory break since we aren't limiting it to the @@ -487,11 +452,6 @@ loop-main() { sleep 10 while true; do premain_sec=$EPOCHSECONDS - # Disabled as the config change seems to be unreliable. I see ssh - # start, then listen on only 1 port even though 2 are listed in the - # config, I can't figure out why, then it starts working randomly. - - #maybe-toggle-ssh main maini=$((maini + 1)) sleep $(( 300 - ( EPOCHSECONDS - premain_sec ) ))