From: Ian Kelling Date: Mon, 24 Jun 2024 03:10:37 +0000 (-0400) Subject: minor fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=76eeb55892bcb4d8fe04527b84d8fc5ec0e5b280;p=distro-setup minor fixes --- diff --git a/brc2 b/brc2 index b9d35c0..58703b4 100644 --- a/brc2 +++ b/brc2 @@ -3790,7 +3790,11 @@ spamf() { # spamtest on FILE e spamtest error: expected 1 arg, filename >&2 return 1 fi - sdncmdroot spamassassin sudo -u Debian-exim spamassassin -t --cf='score PYZOR_CHECK 0' <"$1" + spamd_ser=spamd + if systemctl cat spamassassin &>/dev/null; then + spamd_ser=spamassassin + fi + sdncmdroot $spamd_ser sudo -u Debian-exim spamassassin -t --cf='score PYZOR_CHECK 0' <"$1" } @@ -4161,7 +4165,11 @@ eximbash() { } spamnn() { local spamdpid - spamdpid=$(systemctl show --property MainPID --value spamassassin) + spamd_ser=spamd + if systemctl cat spamassassin &>/dev/null; then + spamd_ser=spamassassin + fi + spamdpid=$(systemctl show --property MainPID --value $spamd_ser) m sudo nsenter -t $spamdpid -n -m sudo -u Debian-exim spamassassin "$@" } unboundbash() { diff --git a/mail-setup b/mail-setup index 616d39b..0e0c6d0 100755 --- a/mail-setup +++ b/mail-setup @@ -467,13 +467,21 @@ if ! spamd-timer-exists; then first_spamd_run=true fi +# rspamd background. I kept seeing spamassassin at the top of top, and +# seeming to cause my cpu fans to speed up, and remembered that rspamd +# was supposed to be more efficient. But the last benchmark I could find +# was at least 8 years old. so, I did a test of scanning 1 message, +# systemd-run via my jdo func shows: CPU time consumed: 21ms vs +# 946ms. Wow, 2.2% cpu use. Ok, switching. # light version of exim does not have sasl auth support. # note: for bitfolk hosts, unbound has important config with conflink. pi-nostart exim4 exim4-daemon-heavy spamassassin unbound clamav-daemon wireguard +spamd_remove=spamassassin spamd_ser=spamd if systemctl cat spamassassin &>/dev/null; then + spamd_remove=spamd spamd_ser=spamassassin elif $first_spamd_run; then if spamd-timer-exists; then @@ -953,7 +961,7 @@ EOF done ;; *) - for unit in exim4 $spamd_ser dovecot unbound; do + for unit in exim4 $spamd_ser $spamd_remove dovecot unbound; do f=/etc/systemd/system/$unit.service.d/nn.conf if [[ -s $f ]]; then rm -fv $f @@ -1005,6 +1013,7 @@ EOF # 2020-10-19 remove old file. remove this when all hosts updated rm -fv /etc/systemd/system/spamddnsfix.{timer,service} +rm -f /etc/default/$spamd_remove u /etc/default/$spamd_ser <<'EOF' # defaults plus debugging flags for an issue im having OPTIONS="--create-prefs --max-children 5 --helper-home-dir" @@ -1471,7 +1480,6 @@ acl_not_smtp = acl_check_not_smtp DEBBUGS_DOMAIN = b.b8.nz - EOF if dpkg --compare-versions "$(dpkg-query -f='${Version}\n' --show exim4)" ge 4.94; then