White Papers

Best practices for setting up Dell VTL Container or NetVault Backup native virtual tape library (nVTL)
50
Linux
®
/UNIX
®
platform
#!/bin/bash
# !*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*
# Specify the beginning of the barcodes of the
# media you wish to work with here.
# !*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*
# !*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*
# Gather Input from user
# !*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*
echo -n “Enter Media Label Prex to Purge: “ read name
while read media_prex
do
if [[ -z “${media_prex}” ]]
then
echo “That was empty, try again.” else
if [ $media_prex = “.” ]
then
echo “Exiting...” exit 0
echo “Executing now...with $media_prex” break
 done
# End of the loop
nv_home=`head -n -1 /etc/.nv6_home` nvutil=$nv_home/util logle=/tmp/logddclean.log
rm -rf /tmp/mediapurge
# ================================================
# Grab media info on tapes in the VTL
# ================================================
$nvutil/nvreport -class media -exclude “%Librarystatus = Online” -format “%label” -sort “%label” | grep
$media_prex > /tmp/mediapurge
echo “====================================” echo “Processing the following media list:” echo “=========
===========================” cat /tmp/mediapurge|awk ‘{print $1}’
read expired_media < /tmp/mediapurge
# ================================================
# Create an array and throw data into it
# Run commands against the data in the array
# ================================================
#Open le for reading exec 10</tmp/mediapurge let count=0
while read LINE <&10; do
media[$count]=$(echo $LINE | awk ‘{print $1}’) tempstring=${barcodes[$count]}
barcodes[$count]=${tempstring%” “} media_avail[$count]=$LINE
((count++))
done array_num_avail=0
while [ $count -gt 0 ]; do
echo “================================================” echo “Purging Media with label ${media[$array_
num_avail]}” echo “================================================” sleep 1
echo $nvutil/nvremovemedia -medialabel ${media[$array_num_avail]}
echo “================================================”
$nvutil/nvremovemedia -medialabel ${media[$array_num_avail]}
wait sleep 2
let array_num_avail=array_num_avail+1 let count=count-1
done
# close le
exec 10>&-
# Clean up temporary rubbish left behind rm -rf /tmp/mediapurge