Well file contents are part of the mail body, so I dont think I have cron deamon needs any info like that.
Please find below the code am using to perform this activity
Shell Script Code
----------------
emailText=/tmp/msgTxt.log
echo "" > $emailText
echo "Log Report" >> $emailText
echo "" >> $emailText
cat `ls -1tr /home/testadmin/testdir/test.log* | tail -1` >> $emailText
RECIPIENTS=testadmin@info.com
SUBJECT="Log Report Generated on "`date +%d-%m-%Y`"
MAILFILE=$emailText
echo "Sending email..."
echo To: $RECIPIENTS > yy
echo From: "$machineName" >> yy
echo Subject: $SUBJECT >> yy
echo MIME-Version: 1.0 >> yy
echo "Content-Type: multipart/mixed; boundary=MC" >> yy
echo --MC>> yy
echo "Content-Transfer-Encoding: 7bit" >> yy
echo "Content-Type: text/plain; charset=ISO-8859-1" >> yy
cat $MAILFILE >> yy
/usr/lib/sendmail $RECIPIENTS < yy
rm yy
rm $emailText
echo "Done!"
exit 0
This is want is been done in the shell script.
When the script is executed manually I am getting corret mail with mail body containing the "test.log" contents. BUt when executed by a cron job, the email body is missing the test.log contents.
Please advice were am I wrong.
Thanks & Regards,
Anshul