#!/bin/ksh
# hogtracker_new
# Copyright 2000, All Rights Reserved, Reed-Matthews, Inc.
# You'll need to call your environmental file and change the directory structure
. /u01/oraprod.env 
if [ -a $RMINC_TOP/sql/hogtracker_semaphore ]; then
   echo "`date`: hogtracker ALREADY running, NOT restarted..." >>$RMINC_TOP/sql/hoghist
else
   echo "" >> $RMINC_TOP/sql/hoghist
   echo "`date` --- Starting hogtracker execution ------" >>$RMINC_TOP/sql/hoghist
   echo "Do not remove this file." >>$RMINC_TOP/sql/hogtracker_semaphore
   sqlplus apps/apps @$RMINC_TOP/sql/hogtracker.sql  .30 .30 > $RMINC_TOP/sql/hogtracker.temp1
   rtv=$?
   echo "Return=$rtv"
   if [ $rtv -gt 0 ]; then
      echo '^G\c' >> $RMINC_TOP/sql/hoghist
      cat $RMINC_TOP/sql/hogtracker.temp1 |grep HOG|sort -n -b +1 -3 +0 -2 >>$RMINC_TOP/sql/hoghist
      echo '^G\c' >> $RMINC_TOP/sql/hoghist
   else
      echo "****************************************************  No hogs found  ........" >> $RMINC_TOP/sql/hoghist
   fi
   rm $RMINC_TOP/sql/hogtracker_semaphore
   echo "`date` --- Finished hogtracker execution ------">> $RMINC_TOP/sql/hoghist
fi
###

