Hi
Thanks for your reply.Its working fine now.but while appending log information to log file its not working.
log file contains ONLY Following line:
ODSDEV Mon Mar 12 23:23:02 PDT 2007Expedites process Failed
Please see the code below
#:Name : Expedites_test.ksh
#:Path : /bin
#:Author : Venu Narapureddy
#
![Big Grin Smilie](https://www.unix.com/images/smilies/biggrin.gif)
ate : 08-mar-2007
#
![Big Grin Smilie](https://www.unix.com/images/smilies/biggrin.gif)
escription : Script to extract and refresh Expeditesdata.
#:Frequency of job :Monthly
#:History:
#
![Big Grin Smilie](https://www.unix.com/images/smilies/biggrin.gif)
ate: User: Modifications:
#:---------------------------------------------------------------------------
#:02-Jun-2006 Venu Narapureddy Initial version.
#:**************************************************************************
ORACLE_SID=ODSDEV export ORACLE_SID
ORACLE_HOME=/oracle/product/current export ORACLE_HOME
TNS_ADMIN=/var/opt/oracle export TNS_ADMIN
TOP='/users/qtcbi/metrics'; export TOP
MODULE_NAME='Expedites_test';export MODULE_NAME
ORAENV_ASK='NO';export ORAENV_ASK
LOG_FILE="$TOP/log/$MODULE_NAME.$(date +%m%d.%H:%M)"; export LOG_FILE
TMPFILE="/tmp/Expedites_test.lst"; export TMPFILE
NORMAL_MAIL='vnarapur'; export NORMAL_MAIL
ERROR_MAIL='vnarapur'; export ERROR_MAIL
UNAME='ccaisadm'; export UNAME # ORacle User ID
PWORD='changeit'; export PWORD # Oracle Password
echo "METRIX :Expedites : Extract of Expedites " |/bin/tee -a $LOG_FILE
echo "Current System Date Is : $(date) " |/bin/tee -a $LOG_FILE
echo "Script Is : $MODULE_NAME " |/bin/tee -a $LOG_FILE
echo "Working Directory Is : $(pwd) " |/bin/tee -a $LOG_FILE
echo "Host Machine Is : $(hostname) " |/bin/tee -a $LOG_FILE
echo "Oracle Instance Is : $ORACLE_SID " |/bin/tee -a $LOG_FILE
echo "$(date) Monthly job started " |/bin/tee -a $LOG_FILE
echo "$(date) Expedites extraction process Started " |/bin/tee -a $LOG_FILE
$ORACLE_HOME/bin/sqlplus $UNAME/$PWORD@$ORACLE_SID @$TOP/sql/Expedites.sql 25-oc
t-2006 29-oct-2006 |/bin/tee - a $LOG_FILE
errorcount=$(grep ORA - $LOG_FILE | wc -l)
if [[ $errorcount -gt 0 ]]; then
echo "$(date) Process Failed " |/bin/tee - a $LOG_FILE
/usr/bin/mailx -s "METRIX : EXPEDITES : $ORACLE_SID $(date)Expedites process Fai
led " $ERROR_MAIL </tmp/Expedites_test.lst > /dev/null
exit 1
else
echo "$(date) Process Done " |/bin/tee -a $LOG_FILE
/usr/bin/mailx -s "METRIX:EXPEDITES :$ORACLE_SID : LOG File for$(date) " $NORMAL
__MAIL <$LOG_FILE >/
dev/null
exit 0
fi
PWORD='changeit'; export PWORD # Oracle Password
echo "METRIX :Expedites : Extract of Expedites " |/bin/tee -a $LOG_FILE
echo "Current System Date Is : $(date) " |/bin/tee -a $LOG_FILE
echo "Script Is : $MODULE_NAME " |/bin/tee -a $LOG_FILE
echo "Working Directory Is : $(pwd) " |/bin/tee -a $LOG_FILE
echo "Host Machine Is : $(hostname) " |/bin/tee -a $LOG_FILE
echo "Oracle Instance Is : $ORACLE_SID " |/bin/tee -a $LOG_FILE
echo "$(date) Monthly job started " |/bin/tee -a $LOG_FILE
echo "$(date) Expedites extraction process Started " |/bin/tee -a $LOG_FILE
$ORACLE_HOME/bin/sqlplus $UNAME/$PWORD@$ORACLE_SID @$TOP/sql/Expedites.sql 25-oct-2006 29-oct-2006 |/bin/tee - a $LOG_FILE
errorcount=$(grep ORA - $LOG_FILE | wc -l)
if [[ $errorcount -gt 0 ]]; then
echo "$(date) Process Failed " |/bin/tee - a $LOG_FILE10
/usr/bin/mailx -s "METRIX : EXPEDITES : $ORACLE_SID $(date)Expedites process Failed " $ERROR_MAIL </tmp/Expedites_test.lst > /dev/null
exit 1
else
echo "$(date) Process Done " |/bin/tee -a $LOG_FILE
/usr/bin/mailx -s "METRIX:EXPEDITES :$ORACLE_SID : LOG File for$(date) " $NORMAL__MAIL <$LOG_FILE >/
dev/null
exit 0
fi
HiGHLIGHTED part only appending to LOG FILE...but i want all information in log file and as well as in body of the mail.
PLease guide me on this ....
Regards
Venu