From: Ian Kelling Date: Thu, 17 Feb 2022 22:58:03 +0000 (-0500) Subject: minor alerts improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=0249e646cbed14fc191827f95a05044287d419ad;p=distro-setup minor alerts improvements --- diff --git a/brc2 b/brc2 index 9c941fe..9bc89d5 100644 --- a/brc2 +++ b/brc2 @@ -282,6 +282,26 @@ aclear() { system-status _ } +alerts() { + find /var/local/cron-errors /home/iank/cron-errors /sysd-mail-once-state -type f +} +ralerts() { # remote alerts + local ret shell + # this list is duplicated in check-remote-mailqs + for h in bk je li frodo kwwg x3wg x2wg kdwg sywg; do + echo $h: + shell="ssh $h" + if [[ $HOSTNAME == "${h%wg}" ]]; then + shell= + fi + ret=0 + $shell find /var/local/cron-errors /home/iank/cron-errors /sysd-mail-once-state -type f || ret=$? + if (( ret )); then + echo ret:$ret + fi + done +} + ap() { # pushd in case current directory has an ansible.cfg file pushd /a/xans >/dev/null diff --git a/check-remote-mailqs b/check-remote-mailqs index b478101..3caaa61 100755 --- a/check-remote-mailqs +++ b/check-remote-mailqs @@ -9,7 +9,8 @@ source /a/bin/errhandle/err shopt -s nullglob shopt -s dotglob -for h in bk je li frodo kwwg x3wg x2wg kdwg; do +# this list duplicated in brc2 ralerts +for h in bk je li frodo kwwg x3wg x2wg kdwg sywg; do statedir=/b/bash_unpublished/mailq-state statefile=$statedir/$h [[ -d $statedir ]] || continue diff --git a/check-stale-alerts b/check-stale-alerts index 0bf76ef..a6d8c82 100755 --- a/check-stale-alerts +++ b/check-stale-alerts @@ -1,4 +1,12 @@ #!/bin/bash + +time_arg="-ctime +4" +case $1 in + now) + time_arg= + ;; +esac + if [[ ! -e /dev/shm/iank-status ]]; then exit 0 fi diff --git a/fixvpndns b/fixvpndns index 30e0725..0619293 100755 --- a/fixvpndns +++ b/fixvpndns @@ -11,8 +11,9 @@ esac if ! resolvectl dnsovertls tunfsf &>/dev/null; then - echo failed resolvectl dnsovertls tunfsf. rerunning: - resolvectl dnsovertls tunfsf + ## most likely the interface doesnt exist. if we wanted verbose output, then: + # echo failed resolvectl dnsovertls tunfsf. rerunning: + # resolvectl dnsovertls tunfsf ||: exit 0 fi read _ link _ < <(resolvectl dnsovertls tunfsf) diff --git a/hssh b/hssh index 47ca7a7..a239bfe 100755 --- a/hssh +++ b/hssh @@ -31,6 +31,7 @@ timeout -s 9 600 /usr/local/bin/mount-latest-subvol rsync --server -OtpRe.LsfxC . /usr/local /usr/local/bin/mail-backup-clean /usr/local/bin/check-mailq +find /var/local/cron-errors /home/iank/cron-errors /sysd-mail-once-state -type f EOF allow=false diff --git a/mailtest-check b/mailtest-check index cd12bc7..466908d 100755 --- a/mailtest-check +++ b/mailtest-check @@ -76,13 +76,14 @@ esac getspamdpid() { if [[ ! $spamdpid || ! -d /proc/$spamdpid ]]; then - spamdpid=$(systemctl status spamassassin| sed -n '/^ *Main PID:/s/[^0-9]//gp') + spamdpid=$(systemctl status spamassassin| sed -n '/^ *Main PID:/s/[^0-9]//gp' ||:) fi } getspamdpid e spamdpid: $spamdpid if [[ ! $spamdpid ]]; then - echo $HOSTNAME mailtest spamd pid not found + echo $HOSTNAME mailtest spamd pid not found. systemctl status spamassassin: + systemctl status spamassassin fi tmpfile=$(mktemp) for folder in ${folders[@]}; do