Sorry if there has been any confusion , but i would not dream of
manually removing tapes from the libraries , that way madness lies!
heres what I came up with (changes / suggestions most welcome )
#!/usr/bin/ksh
#
# Script: Yank-Daily
# Removes Full Daily Tapes.
#
#
DATE=`date +%d/%m/%Y`
#get tapes from weekly pool and load into TAPE array
set -A TAPES `nsrjb -j mtxexxjbx01 -C |grep DAILY|awk '{print $2}'|
perl -p -e 's/\n/ /g'`
#get Mounted valumes
set -A MOUNTED `nsrjb -j mtxexxjbx01|grep drive|awk '{print $6}'`
#set a Full List
#this is a bit hacky what i really wanted was mminfo -m volume -r
%used !
#mminfo -a -q $used=full,volume=volume -r volume will return volume if
it's full and message if not its not full
#build a list of Full tape volumes
for CART in ${TAPES[*]}
do
mminfo -a -q %used=full,volume=$CART > /dev/null 2>&1
if [ $? -eq "0" ];then
#pop onto array
FULLTAPES[$((${#FULLTAPES[@]} + 1))] = ${CART}
fi
done
if [ ${#FULLTAPES[*]} -eq "0" ];then
echo "None today"
exit 0
fi
#now build a string with the tape list an unload if mounted
for CART in ${FULLTAPES[*]}
do
for LOADED in ${MOUNTED[*]}
do
if [ ${LOADED} = ${CART} ];then
echo "$CART is Loaded - Requesting Unload"
nsrjb -j mtxexxjbx01 -N -u $CART
fi
done
FULLLIST="${FULLLIST} ${CART}"
done
#now we have the list again and all are unmounted withdraw the full
dailys
echo "Now Withdrawing - can take a wee while\n"
nsrjb -j mtxexxjbx01 -Nw ${FULLLIST}
Gavin Reid
"This mail is a natural product. The slight variations in spelling
and grammar enhance its individual character and beauty and in no way
are to be considered flaws or defects."
www.linkedin.com/in/poshpaws
To sign off this list, send email to listserv AT listserv.temple DOT edu and type
"signoff networker" in the body of the email. Please write to networker-request
AT listserv.temple DOT edu if you have any problems with this list. You can access the
archives at http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER
|