Hello,
I have this script running on cron every 20 minutes.
By 12pm daily, our system is expecting all input files to be uploaded by the script.
After this cutoff time, the script would still be running though, but i need some kind of alerts/logs to know which input files weren't received for that day.
These daily input files will be sent to us in different timings:
INPUT_FUBX
INPUT_FSTV
INPUT_FGBR
INPUT_FJMT
INPUT_FWRP
INPUT_FQZN
INPUT_FPBT
INPUT_FMHQ
INPUT_FDGP
Below are some lines from my script:
DATE=`date +%Y%m%d_%H%M%S`
PATH=/my/home/directory/path/
ARCHIVE=/my/archive/directory/path/
LIST="INPUT_FUBX INPUT_FSTV INPUT_FGBR INPUT_FJMT INPUT_FWRP INPUT_FQZN INPUT_FPBT INPUT_FMHQ INPUT_FDGP"
for i in $LIST
do
if [[ ! -a $PATH/$i ]]
then
echo 'Input file '${i}' still missing.'
elif [[ -s $PATH/$i ]]
then
## Call upload processing functions here ##
mv $PATH/$i $ARCHIVE/$i_$DATE
fi
done
With the above, I was able to know which input files were still missing, but only during those certain time specified in cron timings.
I won't know which among the input files were missed out totally after the cutoff time for the day.
Any ideas here?
Also, is there a way to make this script flexible so as whenever we add to the list of input files, say add another file named INPUT_FTBS, I don't need to modify the LIST variable in the script everytime.
Appreciate it.
Thanks much.