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