Article Figure 1 Figure 2 Figure 3 Figure 4
Figure 5 Listing 1 Listing 2 Listing 3 Listing 4 apr2005.tar

Listing 4 Sunday.sh

#!/bin/ksh
#*********************************************************************
# Listing  4
#
# File :  Sumday.sh
#
# Description:
#
# This file tells you how much Oracle data was backed up in
# the scheduled backups on any given day. The syntax is very
# important.
#
#
# Author: John Ouellette
#
#*********************************************************************

if [ -z "$3" ];then
echo syntax $0 month day [xx format ] year [xxxx format]
exit
fi


#Variables
MONTH=$1
DAY=$2
YEAR=$3
DATA=/nsr/res/Data.txt

cd /nsr/res/savegroups/$YEAR/$MONTH


#Catch databases reported in MB
grep -i MB $YEAR-$MONTH-$DAY* | grep -i .sh | cut -d "," -f2 | cut \
  -d " " -f 5 > $DATA

MB=0
while read line
do
  ((MB+=line))
done <  $DATA

let GB1=$(( $MB / 1024  ))

#################################

#Catch databases reported in GB
grep -i GB $YEAR-$MONTH-$DAY* | grep -i .sh | cut -d "," -f2 | cut \
  -d " " -f 5 > $DATA
GB2=0
while read line
do
  ((GB2+=line))
done <  $DATA


#Sum both totals
let TOTAL=$(( $GB1 + $GB2 ))
echo $TOTAL Total GB
#*********************************************************************


Here is sumday.sh in action:

[root@erpapp6 /nsr/res]#./sumday.sh August 01 2004  
451 Total GB
[root@erpapp6 /nsr/res]#./sumday.sh September 01 2004
527 Total GB
[root@erpapp6 /nsr/res]#./sumday.sh October 01 2004 
624 Total GB