Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jan 2003 12:19:20 -0500 (EST)
From:      Garrett Wollman <wollman@lcs.mit.edu>
To:        arch@FreeBSD.org
Subject:   CFR: etc/periodic/daily/150.hoststat
Message-ID:  <200301071719.h07HJK7k098679@khavrinen.lcs.mit.edu>

next in thread | raw e-mail | index | archive | help
Some time after I wrote the first version of this script, sendmail
itself grew the ability to do what it does -- and sendmail does a much
better job of it than this script ever could, since sendmail
understands when it would itself consider the file stale.

Since I wrote the script, it has grown some rather pointless
excrescences.  The following patch removes those and calls sendmail in
the appropriate way to make it clean up after itself.  As a result of
this change, the pathname of the host status directory is no longer
bogusly hard-coded in the script, so people who actually follow the
sendmail documentation will be able to take advantage of it.

Unfortunately, there is no easy way to tell whether this feature is
enabled in sendmail or not.

-GAWollman

Index: etc/defaults/periodic.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/periodic.conf,v
retrieving revision 1.22
diff -u -r1.22 periodic.conf
--- etc/defaults/periodic.conf	25 Oct 2002 15:16:54 -0000	1.22
+++ etc/defaults/periodic.conf	7 Jan 2003 17:13:04 -0000
@@ -60,9 +60,8 @@
 daily_clean_rwho_verbose="YES"				# Mention files deleted
 
 # 150.clean-hoststat
-daily_clean_hoststat_enable="YES"			# Delete .hoststat daily
-daily_clean_hoststat_days=3				# If not modified for
-daily_clean_hoststat_verbose="YES"			# Mention files deleted
+daily_clean_hoststat_enable="YES"			# Purge sendmail MX
+							# host cache daily
 
 # 200.backup-passwd
 daily_backup_passwd_enable="YES"			# Backup passwd & group
Index: etc/periodic/daily/150.clean-hoststat
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/150.clean-hoststat,v
retrieving revision 1.6
diff -u -r1.6 150.clean-hoststat
--- etc/periodic/daily/150.clean-hoststat	12 Aug 2002 11:09:01 -0000	1.6
+++ etc/periodic/daily/150.clean-hoststat	7 Jan 2003 17:13:05 -0000
@@ -14,34 +14,13 @@
 
 case "$daily_clean_hoststat_enable" in
     [Yy][Ee][Ss])
-	if [ -z "$daily_clean_hoststat_days" ]; then
-	    echo '$daily_clean_hoststat_enable is enabled but' \
-		'$daily_clean_hoststat_days is not set'
-	    rc=2
-	elif [ ! -d /var/spool/.hoststat ]; then
-	    echo '$daily_clean_hoststat_enable is enabled but' \
-		"/var/spool/.hoststat doesn't exist"
+	if [ -z "$(sendmail -bh 2>&1)" ]; then
 	    rc=2
 	else
 	    echo ""
-	    echo "Removing stale files from /var/spool/.hoststat:"
-
-	    case "$daily_clean_hoststat_verbose" in
-		[Yy][Ee][Ss])
-		    print=-print;;
-		*)
-		    print=;;
-	    esac
-
-	    if [ -d /var/spool/.hoststat ]; then
-		cd /var/spool/.hoststat
-		rc=$(find . ! -name . -mtime +$daily_clean_hoststat_days \
-		    -delete $print | tee /dev/stderr | wc -l)
-		[ -z "$print" ] && rc=0
-		[ $rc -gt 1 ] && rc=1
-	    else
-		rc=3
-	    fi
+	    echo "Removing stale entries from sendmail host status cache:"
+	    rc=0
+	    sendmail -bH || rc=1
 	fi;;
 
     *)  rc=0;;
Index: share_man_man5/periodic.conf.5
===================================================================
RCS file: /home/ncvs/src/share/man/man5/periodic.conf.5,v
retrieving revision 1.44
diff -u -r1.44 periodic.conf.5
--- share_man_man5/periodic.conf.5	12 Dec 2002 17:25:57 -0000	1.44
+++ share_man_man5/periodic.conf.5	7 Jan 2003 17:13:05 -0000
@@ -236,18 +236,16 @@
 .Pq Vt bool
 Set to
 .Dq YES
-if you wish old files in
-.Pa /var/spool/.hoststat
-to be purged.
-.It Va daily_clean_hoststat_days
-.Pq Vt num
-Set to the number of days that files must not have been modified before
-they are deleted.
-.It Va daily_clean_hoststat_verbose
-.Pq Vt bool
-Set to
-.Dq YES
-if you want the removed files to be reported in your daily output.
+to run
+.Ic sendmail -bH
+to automatically purge stale entries from
+.Xr sendmail 8 Ns 's
+host status cache.
+Files will be deleted using the same criteria as
+.Nm sendmail
+would normally use when determining whether to use them,
+which are configured in
+.Pa /etc/mail/sendmail.cf .
 .It Va daily_backup_passwd_enable
 .Pq Vt bool
 Set to

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301071719.h07HJK7k098679>