diff options
author | wollman <wollman@FreeBSD.org> | 2003-01-08 18:51:45 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2003-01-08 18:51:45 +0000 |
commit | 62de1738a47a94b77d2c2bec5cb857d7a5a8d8d0 (patch) | |
tree | 23de19c285b135c2a10be9d3d7b8b9bd3c6fd464 | |
parent | 8267f212f329a6c59b9e135d89c74c1b6098f0dd (diff) | |
download | FreeBSD-src-62de1738a47a94b77d2c2bec5cb857d7a5a8d8d0.zip FreeBSD-src-62de1738a47a94b77d2c2bec5cb857d7a5a8d8d0.tar.gz |
Do not do manually what sendmail(8) can do better automatically.
Tell sendmail to clean up its own host status cache.
The error condition handling could probably be done better.
-rw-r--r-- | etc/defaults/periodic.conf | 5 | ||||
-rwxr-xr-x | etc/periodic/daily/150.clean-hoststat | 29 | ||||
-rw-r--r-- | share/man/man5/periodic.conf.5 | 25 |
3 files changed, 18 insertions, 41 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 14f2282..6213f25 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -60,9 +60,8 @@ daily_clean_rwho_days=7 # If not modified for 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 diff --git a/etc/periodic/daily/150.clean-hoststat b/etc/periodic/daily/150.clean-hoststat index dba3009..473c45b 100755 --- a/etc/periodic/daily/150.clean-hoststat +++ b/etc/periodic/daily/150.clean-hoststat @@ -14,34 +14,13 @@ fi 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;; diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index 888a7b4..e236f97 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -236,18 +236,16 @@ if you want the removed files to be reported in your daily output. .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 believe the cached information, +as configured in +.Pa /etc/mail/sendmail.cf . .It Va daily_backup_passwd_enable .Pq Vt bool Set to @@ -709,7 +707,8 @@ is shared or distributed. .Xr chkgrp 8 , .Xr dump 8 , .Xr newsyslog 8 , -.Xr periodic 8 +.Xr periodic 8 , +.Xr sendmail 8 .Sh HISTORY The .Nm |