1984263bcSMatthew Dillon#!/bin/sh
2984263bcSMatthew Dillon#
3*c451e5e9SAaron LI# $FreeBSD: head/etc/periodic/daily/150.clean-hoststat 124080 2004-01-02 18:50:22Z gshapiro $
4984263bcSMatthew Dillon#
53181538dSGregory Neil Shapiro# Remove stale persistent host status files
6984263bcSMatthew Dillon#
7984263bcSMatthew Dillon
8984263bcSMatthew Dillon# If there is a global system configuration file, suck it in.
9984263bcSMatthew Dillon#
103181538dSGregory Neil Shapiroif [ -r /etc/defaults/periodic.conf ]; then
11984263bcSMatthew Dillon    . /etc/defaults/periodic.conf
12984263bcSMatthew Dillon    source_periodic_confs
13984263bcSMatthew Dillonfi
14984263bcSMatthew Dillon
15984263bcSMatthew Dilloncase "$daily_clean_hoststat_enable" in
16984263bcSMatthew Dillon    [Yy][Ee][Ss])
173181538dSGregory Neil Shapiro	if [ -z "$(hoststat 2>&1)" ]; then
18984263bcSMatthew Dillon	    rc=2
19984263bcSMatthew Dillon	else
20984263bcSMatthew Dillon	    echo ""
213181538dSGregory Neil Shapiro	    echo "Removing stale entries from sendmail host status cache:"
223181538dSGregory Neil Shapiro	    rc=0
233181538dSGregory Neil Shapiro	    purgestat || rc=1
24984263bcSMatthew Dillon	fi;;
25984263bcSMatthew Dillon
26984263bcSMatthew Dillon    *)  rc=0;;
27984263bcSMatthew Dillonesac
28984263bcSMatthew Dillon
29984263bcSMatthew Dillonexit $rc
30