Hi, everyone:
I post a new thread because previous post may sink and I hope the new one can be caught by your eyes.
I created a shell script and the script works fine. However, the mail program part on script didn't send email to my email box and it also didn't provide any traceable infomation. I post the part of code here, please help me to see the coding for mail program part is right or wrong. I append all information to a log file and send the log file content to my email box. Is this right way to invoke mail program on UNIX?
I have tested mail program on that server as: mail -s "test"
myemail@company.com. It works well. It means that mail program on server is working. Only thing is my code on scripts. Please advise. Thanks.
----------------------------------------------------------
date +"%D %T: Database $ORACLE_SID is up and running." >> updt_attrib.log
echo "" >> updt_attrib.log
date +"%D %T: update xxxxxxxx script started." >> updt_attrib.log
# Starte sql script to update xxxxx tables.
sqlplus -s > temp.log 2>&1 dbuser/password@oracle_sid @tools/sql_script_name.sql
if [ $? = 0 ]
then date +"%D %T: scripts successfully executed." >> updt_attrib.log
else date +"%D %T: Error executing script." >> updt_attrib.log
grep "ORA-" temp.log >> updt_attrib.log
date +"%D %T: Exiting script." >> updt_attrib.log
exit 1
fi
done
date +"%D %T: End update xxxxx in xxxx tables." updt_attrib.log
echo "" >> updt_attrib.log
mail -s "Subject Line"
myemail@company.com < updt_attrib.log
exit 0