#!/usr/local/bin/ksh
#################################################################################
# Script ntbackupproc #
# Description Removes all the ugly characters placed in the log files by MS. #
# Then the most recent file is tailed back to the user so data #
# can be recorded in the logbook. #
# Modifications 02/20/03 - Changed tailing of log files so it only retrieves 5 #
# lines and doesn't grab the last couple of files in the backup. #
# - rmorten #
# 03/24/03 - Commented out sparty stuff as sparty has been put to #
# sleep in favor of saving electricity. - rmorten #
# Written On 02/12/03 #
# Written By Rick Mortensen #
#################################################################################

# Functions

# Program Variables
bkdate=/bin/bkdate
date=/bin/date
awk=/usr/bin/awk
nawk=/usr/local/bin/nawk
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'`
TIME=`$date '+%H%M%S'`

# Directory Variables
TMP=/tmp
LOG=/var/log/backup

# File Variables
CLIFF=backup.cliff
SPARTY=backup.sparty
if [ -s $TMP/backupfilelist.log ]
then
BFILELIST=`cat $TMP/backupfilelist.log | awk '$4 ~ /backup.*log/ {print $4}'`
BFILE=`echo $BFILELIST | awk '{print $10}'`
rm -fr $TMP/backupfilelist.log
else
echo "$TMP/backupfilelist.log is missing; Cannot continue.. Exiting..."
exit
fi
TMP1=/tmp/tmp1.$$
TMP2=/tmp/tmp2.$$
TMP3=/tmp/tmp3.$$
TMP4=/tmp/tmp4.$$

# Clean up all the trash characters MS placed in the log files
for file in $BFILELIST
do
if [ -s $TMP/$file ]
then
echo "Cleaning $TMP/$file...\c"
cat -ve $TMP/$file | sed 's/\@//g' | sed 's/\^//g' | sed 's/\M\$//g' > $LOG/$file
echo " Clean. Deleting file..\c"
rm -fr $TMP/$file
echo " Deleted"
else
echo "$TMP/$file is missing"
fi
done

# Might just as well display all the backup info from all three tape devices
#rcp sparty:$LOG/$SPARTY $LOG/$SPARTY
#echo "***********************************"
#echo "Sparty's last backup information"
#echo "-----------------------------------"
#rsh sparty ls -la $LOG/$SPARTY
#tail -5 $LOG/$SPARTY
echo "***********************************"
echo "Cliff's last backup information:"
echo "-----------------------------------"
ls -la $LOG/$CLIFF
tail -5 $LOG/$CLIFF
echo "***********************************"
echo "PDC's last backup information:"
echo "-----------------------------------"
tail $LOG/$BFILE

# Cleanup
rm -fr $TMP1* $TMP2* $TMP3* $TMP4*

 

  • 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