Of course this script need to be run with sudo or under root
#!/bin/ksh
MAXSIZE=50
USERID_BOUNDARY=1000 # normaly regular userid start at a certain number, low userid habitualy are reserved for the system and applications
IFS=":"
while read username two userid groupid five homedir rest
do
if [ "$userid" -gt "$USERID_BOUNDARY" ] ; then
MAILADRES="$username@server.com"
if [ "du -sm $homedir | cut -f 1" > "$MAXSIZE" ] ; then
echo "$homedir too big" | /usr/sbin/sendmail $MAILADRES
echo "test";
fi
fi
done < /etc/passwd