Hi,
I am calling a script log.sh from output.sh.
Log.sh has below pice of code:
IFILE=/home/home1/Report1.csv
if awk -F, '$6==0 && $7==0{exit 1}' ${IFILE}
then
awk -F, '
BEGIN{
c=split("1,6,2,3,4,5,6", col)
print "To: abc@gmail.com"
print "Subject: Error report"
print "MIME-Version: 1.0"
print "Content-Type: text/html"
print "Content-Disposition: inline\n"
print "<HTML><TABLE border=1>"
print "<TH>Heading 1</TH><TH>Heading 2</TH><TH>Heading 3</TH>"
print "<TH>Heading 4</TH><TH>Heading 5</TH><TH>Heading 6</TH>"
print "<TH>Heading 7</TH>"
}
NR>4 {
printf "<TR>"
for(i=1;i<=c;i++) printf "<TD>%s</TD>", $col
print "</TR>"
}
END{
print "</TABLE></BODY></HTML>"
} ' ${IFILE} | sendmail -t
fi
Output.sh has below pice of code:
log=/home/va59657
rndt=`date "+%Y%m%d"`
OFILE1="${log}/${rndt}.log"
echo " REPORT " >> $OFILE1
echo " " >> ${OFILE1}
echo " " >> ${OFILE1}
echo "###################################################################################################################################" >> $OFILE1
echo " " >> ${OFILE1}
/home/va59657/log.sh >> $OFILE1
cat $OFILE1 | mail -s "Report" abc@gmail.com
However when i am running output.sh i am getting two separate emails with subject Error report and Report.ie output of log.sh(
/home/va59657/log.sh.sh >> $OFILE1)is not going to $OFILE and mail is coming because of sendmail -t command used in log.sh.
When i am removing sendmail -t command in log.sh,html code is coming in email instead of actual output in tabular form from output.sh.
I want only one email with output of log.sh in output.sh mail with subject Report and no two separate emails.
Please help.