This is what I’m trying to do…
We have a script that FTP files 3 times a day, once ant 02:30, 04:00 and 13:00. Once the process runs it puts a copy of the file sent in the processed folder. What I’m trying to do is check to see if the files are there and if not send an alert /email.
The file names are IVF_20100806_*.150, PLAZ_ 20100806_*.151, TRAN_20100806_*.152 and TRAN_20100806_*.151
This is what I have
#!/bin/ksh
#
. ${HOME}/.bash_profile
check_file()
{
pattern="${1}_`date '+%Y%m%d'`_${3}"
echo "Checking ${pattern}"
found="NO"
for x in `ls /home/oracle/INCOMING/PROCESSED/${pattern} 2>/dev/null`
do
echo "Found ${x}"
echo "Is it recent?"
chk=`./is_recent ${x} ${3}`
echo ${chk}
if [ "${chk}" = "YES" ]
then
found="YES"
fi
done
if [ "${found}" = "NO" ]
then
echo "Did not receive ${1} file, sending an e-mail to
XXX@XXX.com"
mailx -s"Did not receive ${1} file"
XXX@XXX.com < /dev/null
fi
}
check_file TRAN "*151" 1
check_file TRAN "*152" 1
check_file IVF "*" 1
# check_file POSI "*" 1
# check_file DIF "*" 1
check_file PLAZ "*" 1