#!/usr/local/bin/ksh ################################################################################# # Script ecs.backup # # Description Changes ecs.cfg to current backup name. # # Written On 05/06/01 # # Modifications 12/11/01 - Added the ability to discern changes from the file # # previous. If there were changes then we copy the yesterday # # file to an archive directory for an indefinite period of time. # # - rmorten # # Written By Rick Mortensen # ################################################################################# # Program Variables bkdate=/bin/bkdate awk=/usr/bin/awk htod=/home/bin/htod dtoh=/home/bin/dtoh DAYMINUS30=`$bkdate -d30 '+%y%m%d'` YESTERDATE=`$bkdate -d1 '+%m/%d'` YESTERDAY=`$bkdate -d1 '+%y%m%d'` DATE=`date '+%m/%d'` DAY=`date '+%y%m%d'` SERIAL=`date '+%y%m%d%H%M%S'` # Directory Variables ECSDIR=/usr/ECS ARCHIVEDIR=$ECSDIR/Config.Archive # File Variables CFG=$ECSDIR/ecs.cfg LASTFILENAME=`cat $ECSDIR/last.cfg.filename` TODAYFILENAME=ecs.$SERIAL.cfg # Test for tmp file and if it missing, exit if [ -s $CFG ] then : else echo "\ncfg file missing; exiting...\n" exit fi mv $CFG $ECSDIR/$TODAYFILENAME /usr/bin/diff $ECSDIR/$TODAYFILENAME $ECSDIR/$LASTFILENAME > /dev/null 2>&1 if [ $? -eq 1 ] then cp $ECSDIR/$LASTFILENAME $ARCHIVEDIR/$LASTFILENAME fi rm -fr $ECSDIR/*${DAYMINUS30}* echo ecs.$SERIAL.cfg > $ECSDIR/last.cfg.filename