This page shows the script used to check to make sure the right tapes are
loaded and if so, updates the volume database using an undocumented command.
This releases you from having to manually syncronize the tapes once you
load them when they come back from offsite. The output mailed from the
script can be seen here.
Please let me know if you have any suggestions or improvements for this script.
#!/bin/ksh
# Make sure tapes are loaded for Sunday nbdup
#
# Top directory for files
TOPDIR=/usr/local/lib/netbackup
# Who to notify
MAILTO=whoever
# File used to keep sequence rotation
OFFSITEFILE=${TOPDIR}/.offsite
OFFSITENUM=`cat $OFFSITEFILE`
case $OFFSITENUM in
1)
OFFSITENUM=2
FIRSTTAPE=000080
;;
2)
OFFSITENUM=3
FIRSTTAPE=000090
;;
3)
OFFSITENUM=1
FIRSTTAPE=000070
;;
*)
OFFSITENUM=1
FIRSTTAPE=000070
;;
esac
# See what's physically loaded and email if new tapes must go in
# The "72" is the slot number for the first tape, on my ADIC 480
LOADEDTAPE=`/usr/openv/volmgr/bin/vmcheckxxx -rt tld -r 0 -rh ipswich -vmhost ipswich | awk ' $1 ~ /72/ { print $3 } '`
if [ $LOADEDTAPE != $FIRSTTAPE ]
then
echo "A query shows that the required offsite set (OFFSITE${OFFSITENUM}," > /tmp/nbtapechk.out
echo "starting with tape $FIRSTTAPE) is not loaded. Please load set OFFSITE${OFFSITENUM}" >> /tmp/nbtapechk.out
echo "and then run the script $0". >> /tmp/nbtapechk.out
cat /tmp/nbtapechk.out | mailx -s "Incorrect tapes in library" $MAILTO
rm -f /tmp/nbtapechk.out
exit
fi
# See what the volume manager shows
VOLMGRMTAPE=`/usr/openv/volmgr/bin/vmquery -bx -rn 0 | awk ' $5 ~ /72/ { print $1 } '`
if [ $VOLMGRMTAPE != $FIRSTTAPE ]
then
echo "Volume manager showed $VOLMGRMTAPE loaded but OFFSITE${OFFSITENUM} (Tape $FIRSTTAPE) is scheduled.\nRan robupdt to update the robot volume inventory on ipswich." > /tmp/robupdt.out
/usr/openv/volmgr/bin/vmupdate -x -rn 0 -rt tld -rh ipswich \
-vh ipswich -use_barcode_rules -use_seed >> /tmp/robupdt.out 2>&1
cat /tmp/robupdt.out | mailx -s "Updated volume database" $MAILTO
rm -f /tmp/robupdt.out
fi