how to check if a new line has been added to a file?

Have come up with the following but it doesn't seem to work.. Is there some other command i could use to get this to work?

OUTPATH=/home/out
PARMFILE=$OUTPATH/jobcount_test.txt
LOG=$OUTPATH/job_count_monthlymail_log.txt
HLOG=$OUTPATH/job_count_monthlymail_hlog.txt
#
echo " started at $(date)" > $LOG
#
integer count=0
while [[ $count < 2 ]]
do
   body_msg=`tail -1 $PARMFILE`
   mailx -s "$body_msg" jarrathy@notes < $body_msg
   ((count = count +1))

done
##
echo " ended at $(date)" >> $LOG
cat $LOG >> $HLOG

I was updating the jobcount_test.txt and was hoping when i entered in a new line that the script would mail out that line and that when I had two lines in there the job would stop but it didn't.. can someone tell me what i'm doing wrong?

Hi,
i m not sure exactly what you want..suppose if you want to know only when there is new line comes in your log ...then below will work...

i did small change in your script..

OUTPATH=/home/out
PARMFILE=$OUTPATH/jobcount_test.txt
LOG=$OUTPATH/job_count_monthlymail_log.txt
HLOG=$OUTPATH/job_count_monthlymail_hlog.txt
#
echo " started at $(date)" > $LOG
#
Linecount=`wc -l $PARMFILE|awk '{print $2}'`

while [[ $Linecount -le 2 ]]
do
   body_msg=`tail -1 $PARMFILE`
   mailx -s "$body_msg" jarrathy@notes < $body_msg
done
##
echo " ended at $(date)" >> $LOG
cat $LOG >> $HLOG

Thanks
SHa

Completely forgot about line counts... Thanks for that..

trying to set up a script that will keep running until a certain amount of lines are expected in the file, while also emailing out each new line that comes into that file

Tried what you suggested.. My while loop didn't like -le so changed it to < (using ksh so not sure if thats why -le didn't work)
Ran the script again and it didn't work.. Loop didn't exit out when i put two lines into the file.

Not sure where to go from here