Mail only files with contents
Dear all,
RHEL El 5
Am using the below script to send mails as an sql output . but the below script sends the generated file even if it is empty (if there is no outputs generated from the sql command) .
I want to send mail only if the file has some valid outputs. How to do this
{code}
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
cat <filename.ext> | mail -s "ALERTMEDDB$DATE_SUFFIX" <mailid>
mailx -s "ALERTMEDDB$DATE_SUFFIX" mailid < $tmpdir/ALERTMEDDB$DATE_SUFFIX.log &
{code}
Kai
Last edited by kais1; 06-29-2011 at 03:04 AM.
|