#!/bin/sh -
#
# $FreeBSD: stable/2.2/etc/monthly 50952 1999-09-05 11:54:50Z peter $
#	@(#)monthly	5.5 (Berkeley) 6/17/91
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin
host=`hostname`
echo "Subject: $host monthly run output"

W=/var/log/wtmp
if [ -f $W ] ; then
	# Work out what month it was yesterday
	M=`date -v-1m +%h`

	mv -f $W $W.$M
	touch $W

	if [ -x /usr/sbin/ac ] ; then
		echo ""
		echo "Doing login accounting:"

		ac -p -w $W.$M | sort -nr +1
	fi

	rm -f $W.$M.gz
	gzip $W.$M
fi

if [ -f /etc/monthly.local ]; then
    echo ""
    echo "Running monthly.local:"
    sh /etc/monthly.local
fi
