Hi ,
Below is the part of Ksh.I have written.
The sql below generates list of records for undelivered letters.
## - spool undelivered letter list
cd $cs_LOG
$ORACLE_BIN/sqlplus $USER/$PASS @$cs_PROG/spool_undelivered_letters.sql
The below Ksh check for the file and send emails.
##if log file is not empty save it with the date and send email
if [ ! -s $cs_LOG/undelivered_letters.log ]; then
echo 'all letters delivered'
else
cp $cs_LOG/undelivered_letters.log $cs_LOG/undelivered_letters_age29.log.`date +%Y%m%d`
echo 'Undelivered letters check cust serv letters log directory ' `date` | /usr/bin/mailx \
-c
test@yahoo.com \
-r
eletters@xxx.com \
-s 'Undelivered letters' \
test@yahoo.com;
fi
But My problem is even though the spool does not contain any data it sends email.
The requirement is if undelivered_letters.log does not contain any data then we are not supposed to send the email.If it has data then we sould send email.