git: c934f2a574e2 - main - daily 150.clean-hoststat: suppress error when using dma

From: Mike Karels <karels_at_FreeBSD.org>
Date: Fri, 16 Dec 2022 15:13:46 UTC
The branch main has been updated by karels:

URL: https://cgit.FreeBSD.org/src/commit/?id=c934f2a574e246eef0e27558d310952e5524e85e

commit c934f2a574e246eef0e27558d310952e5524e85e
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2022-12-16 15:13:07 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2022-12-16 15:13:07 +0000

    daily 150.clean-hoststat: suppress error when using dma
    
    dma(8) does not have hoststat or purgestat, so this script produces
    an error from the daily script.  We could disable this script, but
    that would mean yet another change to switch back to sendmail.  Check
    for purgestat in mailer.conf before attempting either hoststat or
    purgestat.
    
    Reviewed by:    pstef, bapt
    Differential Revision:  https://reviews.freebsd.org/D37712
---
 usr.sbin/periodic/etc/daily/150.clean-hoststat | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/periodic/etc/daily/150.clean-hoststat b/usr.sbin/periodic/etc/daily/150.clean-hoststat
index 460d1a267908..54d4d4c21dab 100755
--- a/usr.sbin/periodic/etc/daily/150.clean-hoststat
+++ b/usr.sbin/periodic/etc/daily/150.clean-hoststat
@@ -2,7 +2,7 @@
 #
 # $FreeBSD$
 #
-# Remove stale persistent host status files
+# Remove stale persistent host status files if the mailer supports it.
 #
 
 # If there is a global system configuration file, suck it in.
@@ -14,7 +14,9 @@ fi
 
 case "$daily_clean_hoststat_enable" in
     [Yy][Ee][Ss])
-	if [ -z "$(hoststat 2>&1)" ]; then
+	if ! grep -q '^purgestat' /etc/mail/mailer.conf; then
+	    rc=3
+	elif [ -z "$(hoststat 2>&1)" ]; then
 	    rc=2
 	else
 	    echo ""