Dell DR4300e NetVault Backup - Best Practices for Setting up VTL Containers an - Page 50

while read LINE <&10;

Page 50 highlights

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 Prefix to Purge: " read name while read media_prefix do if [[ -z "${media_prefix}" ]] then echo "That was empty, try again." else if [ $media_prefix = "." ] then echo "Exiting..." exit 0 fi echo "Executing now...with $media_prefix" break fi done # End of the loop nv_home=`head -n -1 /etc/.nv6_home` nvutil=$nv_home/util logfile=/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_prefix > /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 file for reading exec 10

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52

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 Prefix to Purge: “ read name
while read media_prefix
do
if [[ -z “${media_prefix}” ]]
then
echo “That was empty, try again.” else
if [ $media_prefix = “.” ]
then
echo “Exiting...” exit 0
echo “Executing now...with $media_prefix” break
fi done
# End of the loop
nv_home=`head -n -1 /etc/.nv6_home` nvutil=$nv_home/util logfile=/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_prefix > /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 file 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 file
exec 10>&-
# Clean up temporary rubbish left behind rm -rf /tmp/mediapurge