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?
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.