xref: /freebsd/usr.sbin/periodic/etc/daily/150.clean-hoststat (revision 058ac3e8063366dafa634d9107642e12b038bf09)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5# Remove stale persistent host status files if the mailer supports it.
6#
7
8# If there is a global system configuration file, suck it in.
9#
10if [ -r /etc/defaults/periodic.conf ]; then
11    . /etc/defaults/periodic.conf
12    source_periodic_confs
13fi
14
15case "$daily_clean_hoststat_enable" in
16    [Yy][Ee][Ss])
17	if ! grep -q '^purgestat' /etc/mail/mailer.conf; then
18	    rc=3
19	elif [ -z "$(hoststat 2>&1)" ]; then
20	    rc=2
21	else
22	    echo ""
23	    echo "Removing stale entries from sendmail host status cache:"
24	    rc=0
25	    purgestat || rc=1
26	fi;;
27
28    *)  rc=0;;
29esac
30
31exit $rc
32