#!/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

 

  • Expect the best and be prepared for the worst.

  • It is the service that counts, the product can be found anywhere...

[Under Construction]This website will always be under construction...
The information contained within this website is confidential and only to be used in conjunction with the employment of Richard C. Mortensen.  All other use is unauthorized.
Send mail to webmaster@can-be-scanned.com with questions or comments about this web site.
Copyright © 2000 PR Enterprises, Inc.
Last modified: June 09, 2000