Veritas-bu

[Veritas-bu] how to get a list of tapes in the tape library

2006-04-27 05:55:23
Subject: [Veritas-bu] how to get a list of tapes in the tape library
From: dave.markham AT fjserv DOT net (Dave Markham)
Date: Thu, 27 Apr 2006 10:55:23 +0100
This script will get you the tapes in the jukebox for a particular
volume pool. You will need to change the awk string where i search for
P1000 to match what you robot is on an sgscan.

The bit which just lists whats in the jukebox is echo "s s" | tldtest -r
<device path to robot>

#!/bin/sh
#set -x

VMDIR=/usr/openv/volmgr/bin
NBUDIR=/usr/openv/netbackup/bin
NBUDIRA=$NBUDIR/admincmd
JBINV=/tmp/tapes-in-jukebox-jbinv

usage()
{
echo "\nUsage: tapes-in-jukebox <Tape Pool Name>\n"
}

if [ "$1" = "" ]
then
        usage
        exit
fi

#robot parameters
if [ -s /tmp/robot ];then
        ROBOT=`cat /tmp/robot`
else
        ROBOT=`/opt/openv/volmgr/bin/sgscan | awk -F: '/P1000/ {print $1}'`
        echo $ROBOT > /tmp/robot
fi

ROBCMD="$VMDIR/tldtest -r $ROBOT"

#Get Jukebox Inventory
get_jb_inv()
{
        cp $JBINV $JBINV.old
        echo "s s" | $ROBCMD | egrep "slot|Barcode" > $JBINV
}


#Command finds scratch tapes
#Get Scratchpool name
#SPname=`$VMDIR/vmpool -listscratch | tail -1`
SPname=$1

#Now lookup scratchpool pool number.
SPnum=`$VMDIR/vmpool -listall | awk -F: '$1=="pool number" {pn=$2}
$1=="pool name" && $2~/^ *'$SPname'$/ {print pn}'`

# Note: vmquery col  1 is tape number
#               col  3 is tape type
#               col 12 is poolname
#               col 20 is "assigned" date

## This works

## For NB 3.4 00/00/00 needs to be 00/00/0000
tapelist=`$VMDIR/vmquery -a -w |  awk '$3 !~ /CLN/ && $12 == "'$SPname'"
{print $1}'`

#echo "tape list is $tapelist"
#exit

get_jb_inv

echo ""
echo "Tapes contained in L1000 which are $SPname"
echo ""

count=0
for x in $tapelist
do
        grep -- $x $JBINV > /dev/null
        if [ $? = 0 ];then
                $VMDIR/vmquery -m $x | egrep "media ID|slot"
                count=`expr $count + 1`
        fi
done

echo ""
echo "Total number of $SPname tapes in Jukebox = $count"






Dave Carlson wrote:
> anyone know the console command for getting a list of tapes that are
> currently in the library? thanks!
>  
>
> *Dave Carlson*
> Associate Systems Engineer
>
> *atlas*^®
> *Partner for Results**
> **^
> *206.816.8221 // *direct*
> 206.850.8980 // *cell
> *dave.carlson AT AtlasSolutions DOT com
> <mailto:dave.carlson AT AtlasSolutions DOT com>* // email
> *_www.AtlasSolutions.com
> <outbind://28/jenniferh/Local%20Settings/Temporary%20Internet%20Files/OLK3/www.AtlasSolutions.com>_
> // *web*
>
>