From owner-freebsd-arch Tue Jan 7 9:19:25 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F02BB37B401 for ; Tue, 7 Jan 2003 09:19:21 -0800 (PST) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B19F43ED8 for ; Tue, 7 Jan 2003 09:19:21 -0800 (PST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.6/8.12.6) with ESMTP id h07HJKCJ098682 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Tue, 7 Jan 2003 12:19:20 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.6/8.12.6/Submit) id h07HJK7k098679; Tue, 7 Jan 2003 12:19:20 -0500 (EST) (envelope-from wollman) Date: Tue, 7 Jan 2003 12:19:20 -0500 (EST) From: Garrett Wollman Message-Id: <200301071719.h07HJK7k098679@khavrinen.lcs.mit.edu> To: arch@FreeBSD.org Subject: CFR: etc/periodic/daily/150.hoststat Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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