Listing 1 sc.sh
#*********************************************************************
# Listing 1
# File: sc.sh
#
# Description:
# This file will:
#
# 1) Email you the savegroup completion report with proper subjects
# 2) Save a history of the SCR on the file system for later review.
#
# Author: John Ouellette
#
#*********************************************************************
DAY=`date +%d`
MNTH=`date +%B`
YEAR=`date +%EY`
TIME=`date +%T`
DIR=/nsr/res/savegroups
MAIL=/usr/bin/mailx
RECP=john_ouellette@yahoo.com
##Dump and Setup
cat > $DIR/$$.rpt
GROUP=`cat $DIR/$$.rpt |grep -i savegroup | cut -d" " -f4`
SUBJECT="$GROUP completion report"
##Email
cat $DIR/$$.rpt | $MAIL -s "$SUBJECT" $RECP
##Cleanup and Sort
echo $DIR $YEAR-$MNTH-$DAY-$TIME-$GROUP.rpt
##Make new Dirs and Move SCRs
mkdir -p $DIR/$YEAR/$MNTH
mv $DIR/$$.rpt $DIR/$YEAR/$MNTH/$YEAR-$MNTH-$DAY-$TIME-$GROUP.rpt
rm $DIR/$$.rpt
#********************************************************************* |