#!/bin/sh

# checkmail
# Andrew Davison (ad@ratree.psu.ac.th), August 1997

# Check $mspool every $time seconds.
# A change is detected by comparing the old size
# of the file with the current one.

mspool="/var/spool/mail/ad"
time=60

osize=`ls -l $mspool | awk '{print $5}'`
while true
do
  csize=`ls -l $mspool | awk '{print $5}'`
  if [ $osize != $csize ]
  then
    echo Mail change: `date`
    osize=$csize
  fi
  sleep $time
done
