TO know whether file is updating or not

Hi All,

I am new to scripting.

my requirement is ,

I want to know whether the file(i.e., log file) is updating or not.
It should search for every 15 min. If it is not updating means it needs to send out a automatic mail.

can you please help me in this.

Something like

#!/bin/sh
while true
do
      if test thefile -ot magic
      then
            echo "stale" | mailx -s warning foo@bar
      fi
      touch magic
      sleep 900
done

Thanks , Its working.