#!/bin/sh 

# name: cleanup_backup.sh
# author: Todd Boss
# purpose: script to clean up old transaction logs for SQL backtrack
# as written runs at 11:30pm, same day after dumps done
#
# creation history
# date          author  purpose
# 03/13/97      T.Boss  creation   
# 04/17/97	T.Boss	modified to also delete lct files, if any.
# 04/18/97	T.Boss	bug fix; new incremental schedule messed up processing
# 05/19/97	T.Boss	modified all /news/prod11 -> /news/prod12 temporarily
# 07/07/97	T.Boss	modified for new dali and /u/backup/.  Added 
#  $dump_parent, changed for loop back to an ls from the env. vars

day=`date +%d`
month=`date +%m`
year=`date +%Y`

#echo $day $month $year

#dump_parent="/news/prod12"
dump_parent="/u/backup/prod11"

normal_dbs=`ls /export/datatools/full_phys/prod11`
#special_dbs=`ls /export/datatools/special/prod11`

#for database in $normal_dbs $special_dbs
for database in `ls /export/datatools/full_phys/prod11`
do
   echo $database
   dumpfile="$database-0.$day-$month-$year.*"
   ls $dump_parent/database/$dumpfile > /dev/null 2>&1
   if [ $? = 0 ]
   then
      echo "  dump finished!  deleting transaction files"
      rm -rf $dump_parent/transaction/$database-0.$day-$month-$year.*
      rm -rf $dump_parent/transaction/$database.lct.$day-$month.*
   fi
done