Cover V09, I11
Article
Listing 1
Listing 2
Listing 3

nov2000.tar


Listing 1: do_backup shell script

#! /bin/sh

# Shell Script to do a root Backup using Veritas Netbackup Utility

hn=`hostname`
sched="Full"
list="/usr/openv/netbackup/filelist.txt"
dateLog="/usr/openv/netbackup/dateLog.txt"
progLog="/usr/openv/netbackup/progLog.txt"
doProgLog=0

if [[ $doProgLog = 1 ]]; then
   echo "Progress Log enabled with log to $progLog"
   echo "With Progress Log backup takes about 3 hrs"
   echo "vi /sbin/do_full and set doProgLog=0 to disable"
   echo "Without Progress Log backup takes about 30 minutes"
fi

doBackup="n"
echo -n "$sched Backup on $hn (y/n)? "
read doBackup

if [[ $doBackup = "y" ]]; then

   if [[ -r $progLog ]]; then
    /sbin/rm -rf $progLog
   fi
   /sbin/touch $progLog

#   keyword="$hn`date +%d%b%y`"
# Append linefeed for $dateLog if needed
# Only Req'd if Last Backup did not complete
   skip=`wc $dateLog | awk '{print $3 - 1 }'`
   lastChar=`dd if=$dateLog bs=1 iseek=$skip count=1`
   if [[ $lastChar == " " ]]; then
    echo "ERROR" >> $dateLog
   fi

   echo "Begining $sched backup on $hn at `date`"
   userName=`who am i | awk '{printf "%-10s",$1}'`
   echo -n "$sched on $hn by $userName [`date '+%a %b %e, %Y] %T'` -- "  \
>> $dateLog if [[ $doProgLog = 1 ]]; then /usr/openv/netbackup/bin/bpbackup -c $hn -s $sched -L $progLog -w -f $list else /usr/openv/netbackup/bin/bpbackup -c $hn -s $sched -w -f $list fi echo "`date '+%T'`" >> $dateLog echo "Completed $sched backup on $hn at `date`" Mail -s "Manual $sched on $hn" dgarrett@nih.gov < $dateLog Mail -s "Manual $sched on $hn" spect-admin@nih.gov < $dateLog fi