The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 03-13-2007
venu_cisco venu_cisco is offline
Registered User
 

Join Date: Mar 2007
Posts: 3
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
#ate : 08-mar-2007
#escription : Script to extract and refresh Expeditesdata.
#:Frequency of job :Monthly
#:History:
#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

Last edited by venu_cisco; 03-13-2007 at 11:56 PM..
Reply With Quote