David
I have only tested this as of this time, but you could use a script
something like the one below. You would want to run this sometime early
Monday, or sometime after your weekly backups are normaly completed. This
skript is set up to run before nightly backups start, and after they
complete. If it is before they start, it will dump the database to one
tape, if it is after they are done, it dumps the database to another tape.
I will be useing this to create the off site tapes. I am using NetBackup
to automaticly create the on site tapes.
This is a Korn Shell script tested on a Sun Solaris 8/Netbackup Datacenter
3.4 Master/Media server with a STK Timberwolf 9738 ATL.
#! /bin/ksh
#
# This script will stop Netbackup, backup up the NetBackup databases
# and restart NetBackup
#
########################### C O N S T A N T S ##########################
CONTINUE=0
HOUR=`date +%H`
############################### S T A R T ##############################
echo "Netbackup Database backup started at "`date`
while [ $CONTINUE != 1 ]
do
#Check for any active jobs
QUEUED=`bpdbjobs -summary | sed -e '/MASTER/d' | awk '{print $2}'`
REQUEUED=`bpdbjobs -summary | sed -e '/MASTER/d' | awk '{print $3}'`
ACTIVE=`bpdbjobs -summary | sed -e '/MASTER/d' | awk '{print $4}'`
if [ $QUEUED -eq 0 ] && [ $REQUEUED -eq 0 ] && [ $ACTIVE -eq 0 ]
then
#Check if this is before the nightly backups
if [ $HOUR -eq "17" ]
then
#If before Nightly backups move tape from slot 3 to tape drive rmt/0
/usr/openv/volmgr/bin/tldtest -r /dev/sg/c4t0l0 -d1 /dev/rmt/1cbn -d2
/dev/rmt/0cbn <<EOF
m s3 d2
q
EOF
else
#If after nightly backups, move tape from slot 4 to tape drive rmt/0
/usr/openv/volmgr/bin/tldtest -r /dev/sg/c4t0l0 -d1 /dev/rmt/1cbn -d2
/dev/rmt/0cbn <<EOF
m s4 d2
q
EOF
fi
echo "move complete"
# Shutdown NetBAckup
/usr/openv/netbackup/bin/admincmd/bprdreq -terminate
# Backup databases
/usr/openv/netbackup/bin/admincmd/bpbackupdb -tpath /dev/rmt/0
# Restart NetBackup
/usr/openv/netbackup/bin/bprd
#Check if this is before the nightly backups
if [ $HOUR -eq "17" ]
then
#If before nightly backups, move tape from tape drive rmt/0 to slot 3
/usr/openv/volmgr/bin/tldtest -r /dev/sg/c4t0l0 -d1 /dev/rmt/1cbn -d2
/dev/rmt/0cbn <<EOF
unload d2
m d2 s3
q
EOF
else
#If after nightly backups, move tape from tape drive rmt/0 to slot 4
/usr/openv/volmgr/bin/tldtest -r /dev/sg/c4t0l0 -d1 /dev/rmt/1cbn -d2
/dev/rmt/0cbn <<EOF
unload d2
m d2 s4
q
EOF
fi
export CONTINUE=1
else
#If there are any jobs scheduled or running, sleep for 10 minutes and check
again
sleep 600
echo "sleeping for 10 minutes at "`date`
fi
done
echo "Netbackup Database backup complete at "`date`
################################# E N D ################################
Richard Mickle
UNIX Systems and Storage Admin.
Moore Response Marketing Services
Voice: 920-339-1695
Fax: 920-339-1686
Email: rmickle AT rms.moore DOT com
|