#!/bin/sh
##########################################################################
# $Id: sendmail-largeboxes,v 1.3 2004/06/22 13:48:26 kirk Exp $
##########################################################################

if [ -d /var/mail ]; then
	SPOOLDIR=/var/mail
elif [ -d /var/spool/mail ]; then
	SPOOLDIR=/var/spool/mail
else
	echo "Can't find spool directory"
fi

if [ "$SPOOLDIR" ]; then
	ls -alSh $SPOOLDIR | \
		grep rw | \
		grep -E "([0-9][0-9]|[4-9])+[0-9]+([.][0-9])*[M]" | \
		gawk -F ' ' ' { print("Warning: Large mailbox: "$9" ("$5")") } '
fi

