[Networker] label_volumes.sh (interactive label of recycles/scratch)
2003-11-20 16:25:50
#!/bin/ksh
#
# Name: label_volumes.sh
#
# Location: /usr/local/legato/bin
#
# Purpose: To automate the labeling of volumes
#
# Author:
#
# Date: December 7, 2001
#*******************
# Script Variables *
#*******************
MASTER=mastername
HOST=`uname -n`
NSRJB=`which nsrjb`
UID=`id`
#*************************************************
# Section to query for amount of tapes and pools *
#*************************************************
clear
# This section verifies that the type of tapes is valid *
result=invalid
until [ $result = valid ]
do
echo "\nPlease enter the type of tapes ([r]ecycleable,[s]cratch) you
wish to label: \c"
read answer
if [ $answer = recycleable -o $answer = r ]; then result=valid
type=yes
elif [ $answer = scratch -o $answer = s ]; then result=valid
type="*"
else result=invalid
echo "\ntype you entered is incorrect\n"
fi
done
# This section verifies that the pool is valid *
result=invalid
until [ $result = valid ]
do
echo "\nPlease enter the pool to which you wish to label the tapes:
\c"
read pool
if [ "$pool" = "One Month" ]; then result=valid
elif [ "$pool" = "Default" ]; then result=valid
elif [ "$pool" = "Clone Vault KS" ]; then result=valid
elif [ "$pool" = "Clone Vault FL" ]; then result=valid
elif [ "$pool" = "Clone Vault TX" ]; then result=valid
elif [ "$pool" = "Clone Vault Sungard" ]; then result=valid
elif [ "$pool" = "Archive One" ]; then result=valid
elif [ "$pool" = "Archive Two" ]; then result=valid
elif [ "$pool" = "Archive Five" ]; then result=valid
elif [ "$pool" = "Archive Seven" ]; then result=valid
elif [ "$pool" = "Archive Ten" ]; then result=valid
elif [ "$pool" = "Archive Eleven" ]; then result=valid
elif [ "$pool" = "Archive Clone" ]; then result=valid
elif [ "$pool" = "BR Pool" ]; then result=valid
else result=invalid
echo "\npool you entered is incorrect\n"
fi
done
echo "\nPlease enter the amount of tapes you wish to label: \c"
read amount
#***********************************
# Section to execute the nsrjb job *
#***********************************
echo "\n******* The following is the tape label job results *******\n"
echo $UID | grep root > /dev/null
if [ $? -eq 0 ]
then
for I in $(nsrjb -j mastername_01 | grep "$type" | head -"$amount" |
sed 's/ */ /g' | cut -f1 -d: | cut -c1-6)
do nsrjb -L -j mastername_01 -f /dev/rmt/3cbn -v -Y -b "$pool" -S $I >
/tmp/label.out 2>&1
if [ $? -eq 0 ]; then
TAPE=`grep stl_mount /tmp/label.out | grep volume | cut -f2 -d"," |
cut -c11-16`
echo "$TAPE labeled to pool $pool"
else
echo "\n$I failed to label\n"
fi
done
else
for I in $(sudo nsrjb -j mastername_01 | grep "$type" | head
-"$amount" | sed 's/ */ /g' | cut -f1 -d: | cut -c1-6)
do sudo nsrjb -L -j mastername_01 -f /dev/rmt/3cbn -v -Y -b "$pool" -S
$I \> /tmp/label.out 2\>\&1
if [ $? -eq 0 ]; then
TAPE=`grep stl_mount /tmp/label.out | grep volume | cut -f2 -d"," |
cut -c11-16`
echo "$TAPE labeled to pool $pool"
else
echo "\n$I failed to label\n"
fi
done
fi
echo
--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Networker] label_volumes.sh (interactive label of recycles/scratch),
Reed, Ted G II [ITS] <=
|
|
|