#!/bin/ksh 
#
ORACLE_HOME=/u02/app/oracle/product/ias10g
ORACLE_SID=asdb10g

cd $ORACLE_HOME/ldap/odi/log

#
if [ "`grep Failure ActiveChgImp.aud`" ] ; then

echo "An Error Has Occurred, sending mail to DBA..."
echo "An Error Has Occurred for the following Entry:">/tmp/diperr
echo " " >>/tmp/diperr
grep Failure ActiveChgImp.aud >>/tmp/diperr

echo " " >>/tmp/diperr
echo "Temporarily suspending DIP SYCH operations pending resolution..">>/tmp/diperr
echo " " >>/tmp/diperr

oidctl conn=asdb10g serv=odisrv inst=2 conf=1 stop

# give time for odisrv to stop...
echo Sleeping for 30 seconds to allow server to stop....
sleep 30

# Rename trace files so next iteration of this cron job will not pick up this error again

mv ActiveChgImp.aud ActiveChgImp.aud.ERROR
mv ActiveChgImp.trc ActiveChgImp.trc.ERROR


echo "Details Can Be Found at $ORACLE_HOME/ldap/odi/log/ActiveChgImp.aud.ERROR " >>/tmp/diperr
echo "  and $ORACLE_HOME/ldap/odi/log/ActiveChgImp.trc.ERROR " >>/tmp/diperr
echo " " >>/tmp/diperr
echo "Use DIP Tester to Get Changelog Entry from ActiveDir and reconcile the entry " >>/tmp/diperr
echo "with your mapping rules define in your profile." >>/tmp/diperr
echo " " >>/tmp/diperr

mailx -s "ALERT! A DIP Syncronization Error Has Ocurred" jerry.smith@oracle.com </tmp/diperr

fi




