Veritas-bu

[Veritas-bu] I need to expire a bunch of tapes quickly

2003-06-09 03:17:36
Subject: [Veritas-bu] I need to expire a bunch of tapes quickly
From: jwood AT apa.qwest DOT net (James Wood)
Date: Mon, 9 Jun 2003 01:17:36 -0600
Ok, from a few replies, I have cobbled together this script. It runs the
first file entry, then quits. What have I missed?

(My scripting skills sucketh, BTW)

.....
#!/bin/bsh

MEDIALISTFILE=$1

MEDIALIST="`cat ${MEDIALISTFILE}`"

for MEDIA in ${MEDIALIST}
do

        if [ $MEDIA = Q -o $MEDIA = q ]
                then
                        exit 0
        fi

        CNT=`$VMQUERY/usr/openv/volmgr/bin/vmquery -m $MEDIA 2>&1 | grep
"volume does not exist in database" | wc -l`

        if [ $CNT = 1 ]
        then
                echo
                echo "Error: that tape id is not in the Veritas media
database."
                echo "Please enter a valid tape id."
                continue
        fi

        break

POOL=`$VMQUERY/usr/openv/volmgr/bin/vmquery -m $MEDIA | grep "volume pool:"
| cut -d"(" -f2 | cut -d")" -f1`

if test "x$POOL" = "x"
then
        echo "Error: problem encountered trying to get pool number."
        exit
fi

$VMQUERY/usr/openv/volmgr/bin/vmquery -deassignbyid $MEDIA $POOL 0

if [ $? != 0 ]
then
        echo "Error: problem encountered trying to un-assign media"
        exit
fi
done