X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mailtest-check;h=9f37cb94ab6513352295c0e5debdcf8a24bba540;hb=55b37c2dbe292fa1023c0c5376c2104fbe568011;hp=db5df60e0b883a5d4de948960e03c9f09b7da49a;hpb=3342374657bd712f14cd772378b23d2bca3382cb;p=distro-setup diff --git a/mailtest-check b/mailtest-check index db5df60..9f37cb9 100755 --- a/mailtest-check +++ b/mailtest-check @@ -28,11 +28,13 @@ # for non-interactive, dont print unless something went # wrong +#set -x -source /b/bash-bear-trap/bash-bear [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" +source /b/bash-bear-trap/bash-bear + shopt -s nullglob e() { $int || return 0; printf "mailtest-check: %s\n" "$*"; } @@ -83,6 +85,8 @@ fi # TODO, get je to deliver the local mailbox: /m/md/INBOX # dovecot appears to setup, i can t be sure. +maini=0 + spamd_ser=spamd if systemctl cat spamassassin &>/dev/null; then spamd_ser=spamassassin @@ -114,7 +118,11 @@ main() { ;; *) folders=(/m/md/l/testignore) - froms=(testignore@je.b8.nz testignore@expertpathologyreview.com testignore@amnimal.ninja ian@iankelling.org z@zroe.org) + # save some cpu cycles + froms=(testignore@je.b8.nz ian@iankelling.org) + if (( maini % 10 == 0 )); then + froms=(testignore@je.b8.nz testignore@expertpathologyreview.com testignore@amnimal.ninja ian@iankelling.org z@zroe.org) + fi if ! $int; then ### begin rsyncing fencepost email ### # We dont want to exit if rsync fails, that will get caught by @@ -208,7 +216,8 @@ EOF # example line that sed is parsing: # (-0.1 / 5.0 requ) DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,SPF_HELO_PASS=-0.001,SPF_PASS=-0.001,TVD_SPACE_RATIO=0.001 autolearn=_AUTOLEARN resultfile=$(mktemp) - $spamcpre sudo -u Debian-exim spamassassin -D -t --cf='score PYZOR_CHECK 0' <"$latest" &>$resultfile + # add -D for debug info. usually it + $spamcpre sudo -u Debian-exim spamassassin -t --cf='score PYZOR_CHECK 0' <"$latest" &>$resultfile # note: on some mail, its 1 line after the send-test-forward, on others its 2 with a blank inbetween. # I use the sed -n to filter this. @@ -336,7 +345,7 @@ EOF if $doprom && [[ -e $dir ]]; then for l in "${p_unexpected_spamd_results[@]}"; do printf "%s\n" "$l" >>$path - done + done for l in "${p_missing_dnswl[@]}"; do printf "%s\n" "$l" >>$path done @@ -355,12 +364,13 @@ loop-main() { while true; do premain_sec=$EPOCHSECONDS main + maini=$((maini + 1)) sleep $(( 300 - ( EPOCHSECONDS - premain_sec ) )) done } -if [[ $INVOCATION_ID ]]; then +if [[ $PPID == 1 ]]; then loop-main else main