Need help with if statement [message #254076] |
Wed, 25 July 2007 12:48 |
toshidas2000
Messages: 120 Registered: November 2005
|
Senior Member |
|
|
echo
timeecho "VERIFY LOGFILE FOR NOTIFICATION"
echo
subject="Logfile Status"
body="Status:"
Econ=`egrep -e "ORA-" ${LOGFILE} | wc -l`
ECon1=`grep -li "File complete" ${LOGFILE} | wc -l`
echo "Econ is $Econ and ECon1 is $ECon1"
if test `egrep -e "ORA-" ${LOGFILE} | wc -l` -gt 0 ||
test `grep -li "File complete" ${LOGFILE} | wc -l` -eq 0
echo "IF SEND EMAIL"
then
echo "ELSE SEND EMAIL"
SendEmail I "${subject}" "Logfile failed" "emailaddress"
else
SendEmail I "${subject}" "Logfile Processed" "emailaddress"
echo
timeecho "NOTIFICATION SEND"
echo
I see my logfile does not have ORA messages and File completed is there. Still I get email Logfile failed in my email. Why??
Following is the output of script
+ subject=Logfile Status
+ body=Log file /opt/oracle/job_072507.log follows:
+
+ + wc -l
+ egrep -e ORA- /opt/oracle/job_072507.log
Econ= 0
+ + wc -l
+ grep -li File complete /opt/oracle/job_072507.log
ECon1= 1
+ echo Econ is 0 and ECon1 is 1
Econ is 0 and ECon1 is 1
+ wc -l
+ egrep -e ORA- /opt/oracle/job_072507.log
+ test 0 -gt 0
+ wc -l
+ grep -li File complete /opt/oracle/job_072507.log
+ test 1 -eq 0
+ SendEmail I "Logfile Status" "Logfile failed" "emailaddress"
+ timeecho NOTIFICATION SEND
04:06:06: NOTIFICATION SEND
+ echo
|
|
|
|