I am trying to do a shell script to check a folder and see if files are passing through.
Now if a file did not pass through in the last 1 hour send an email.
ftp----------> folder to monitor ----------->ftp
Now the script that moves the file runs every sec in cron, so i do not know if i could list it to get the info. Should i write to a file?
This is what i came up with so far
#Set the path to the folder to monitor
SUBJECT="DWH FILES WERE NOT SENT IN THE LAST HOUR"
FILE1="/home/tibco/javastuff/test/dwh*"
cd /home/tibco/javastuff/test/
###### Run list command
ls -l
time=`echo $line | awk '{ split($8,a,":"); print (a[1]*60)+a[2] }'`
FILEMATCH=`echo $line | awk '{ print $9 }'`
if [ $FILE1 = $FILEMATCH ]
then
echo "$time" > dwhtime.txt
else
echo running else statement
######## Run date command ##########
date
time2=`echo $line | awk '{ split($4,a,":"); print (a[1]*60)+a[2] }'`
if [ $time2 -gt $time ]
then
mail -s "$SUBJECT" testemail <<EOF
$SUBJECT
$time
EOF
fi
fi
I am not sure whatt to do from here?
Could somebody help me out please.