Hi All
I am trying to run one command ie grep but I want it should execute only after the completion of a shell script has finished.
eg
Following is my script :
java -mx64m $JAVA_OPTS -Dant.home=$ANT_HOME -classpath $_CLASSPATH org.apache.tools.ant.Main -verbose -buildfile /opt/bea/wls
61/config/dev05/batch_automation/MBPSBatch/scripts/build.xml > /opt/bea/wls61/config/dev05/batch_automation/MassTransfer/lo
gs/ant.log 2>&1 &
grep -i "BUILD FAILED" /opt/bea/wls61/config/dev05/batch_automation/MassTransfer/logs/ant.log 2>/dev/null
rcode=$? ############save the return code here if Failed found it would be 0
if [ $? -ne 0 ]
then
echo "No failed found run the script abc.sh"
. /opt/bea/wls61/config/dev05/batch_automation/MassTransfer/startMassTransfer.sh
else
echo "Failed encounter ..."
mailx -s "[`date`] Failure: Error in script"
sdfgg@dgssg.com < /opt/bea/wls61/config/dev05/batch_automation/Mass
Transfer/logs/ant.log
echo "Error was encountered in your script" | mailx -s "ALERT!!"
dsfhjkhdfsjh@dsfjhl.com
fi
Problem is even though no BUILD FAILED is encountered in ant.log still else part gets executed ie Failed encounter.
Please suggest some ways so that it works on the logic....... if build success ,should process if part , if failure should execute else part
Thanks
Pankaj