Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Script to show available media

Managing Tapes

A Script to show available media

by  mrn  Posted    (Edited  )
How do I show expired media?

I've seen the question posted a couple of times so here my solution to show media thats available to use, you will have to adapt it by changeing it to match your own volume pools

#!/bin/ksh

#
# Media Management
#
clear

echo "Gathering Data....... Please Wait...!\n"

#
# Gathering initial data
#

/usr/openv/netbackup/bin/goodies/available_media > /tmp/look

#
# Altering data to enable awk script to run
#

echo "#!/usr/bin/sed -f" > /tmp/change.it
echo "/^$/d" >> /tmp/change.it
echo "/^---/d" >> /tmp/change.it
echo "/^m/d" >> /tmp/change.it
echo "/^ ID/d" >> /tmp/change.it

chmod 777 /tmp/change.it

/tmp/change.it < /tmp/look > /tmp/look1

#
# Split media pools
#

awk -f /usr/openv/netbackup/bin/sort.awk /tmp/look1

#
# Tidy up
#

rm /tmp/change.it
rm /tmp/look

#
# Setup Continue
#

Cont () {
echo "\n Hit enter to continue...\c"
read z
}

#
# Check Daily Pool Loaded in L180
#

CHECK_DAILY_IN () {
clear
echo "\nDaily Pool\nTapes Currently Loaded & Available To The Robot\n"
cat poolDaily|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/Dailypoolinfo
done

cat /tmp/Dailypoolinfo|grep AVAILABLE|grep SSC|grep -v - > /tmp/aamdp
pg -20 /tmp/aamdp
rm /tmp/Dailypoolinfo
rm /tmp/aamdp
}

CHECK_DAILY_OUT () {
clear
echo "\nDaily Pool\nTapes Currently Offsite & Available To Use\n"
cat poolDaily|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/Dailypoolinfo
done

cat /tmp/Dailypoolinfo|grep AVAILABLE|grep SSC|grep - > /tmp/oamdp
pg -20 /tmp/oamdp
rm /tmp/Dailypoolinfo
rm /tmp/oamdp
}

CHECK_WIN2000_IN () {
clear
echo "\nWindows 2000 Pool\nTapes Currently Loaded & Available To The Robot\n"
cat poolWindows2000_OS|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/Win2kpoolinfo
done

cat /tmp/Win2kpoolinfo|grep AVAILABLE|grep SSC|grep -v - > /tmp/aamw2kp
pg /tmp/aamw2kp
rm /tmp/Win2kpoolinfo
rm /tmp/aamw2kp
}

CHECK_WIN2000_OUT () {
clear
echo "\nWindows 2000\nTapes Currently Offsite & Available To Use\n"
cat poolWindows2000_OS|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/Win2kpoolinfo
done

cat /tmp/Win2kpoolinfo|grep AVAILABLE|grep SSC|grep - > /tmp/oamw2kp
pg /tmp/oamw2kp
rm /tmp/Win2kpoolinfo
rm /tmp/oamw2kp
}

CHECK_FROZEN_IN () {
clear
echo "\nDaily Pool\nTapes Currently Loaded & Frozen\n"
cat poolDaily|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/Dailypoolinfo
done

cat /tmp/Dailypoolinfo|grep FROZEN|grep SSC| grep -v - > /tmp/aftdp
pg /tmp/aftdp
rm /tmp/Dailypoolinfo
rm /tmp/aftdp
}

CHECK_FROZEN_OUT () {
clear
echo "\nDaily Pool\nTapes Currently Offsite & Frozen\n"
cat poolDaily|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/Dailypoolinfo
done

cat /tmp/Dailypoolinfo|grep FROZEN|grep SSC| grep - > /tmp/aftdp
pg /tmp/aftdp
rm /tmp/Dailypoolinfo
rm /tmp/aftdp
}

CHECK_W2K_FROZEN_IN () {
clear
echo "\nWin 2000 Pool\nTapes Currently Loaded & Frozen\n"
cat poolWindows2000_OS|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/W2Kpoolinfo
done

cat /tmp/W2Kpoolinfo|grep FROZEN|grep SSC| grep -v - > /tmp/aftdp
pg /tmp/aftdp
rm /tmp/W2Kpoolinfo
rm /tmp/aftdp
}

CHECK_W2K_FROZEN_OUT () {
clear
echo "\nWin 2000 Pool\nTapes Currently Offsite & Frozen\n"
cat poolWindows2000_OS|while read A B C D E F G H I
do
echo $A $E $I >> /tmp/W2Kpoolinfo
done

cat /tmp/W2Kpoolinfo|grep FROZEN|grep SSC| grep - > /tmp/aftdp
pg /tmp/aftdp
rm /tmp/W2Kpoolinfo
rm /tmp/aftdp
}

#
# Main Menu
#

while true
do
clear

echo "\n\t-------------------------------------------"
echo "\t\t\tAvailable Media"
echo "\t-------------------------------------------\n"
echo "\t\t1. View Available Unix Tapes Loaded in Robot"
echo "\t\t2. View Available Unix Tapes Offsite"
echo "\t\t3. View Available Win2000 Tapes Loaded in Robot"
echo "\t\t4. View Available Win2000 Tapes Offsite"
echo "\t\t5 View Frozen Unix Tapes Loaded in Robot"
echo "\t\t6. View Frozen Unix Tapes Offsite"
echo "\t\t7. View Frozen Win2000 Tapes Loaded in Robot"
echo "\t\t8. View Frozen Win2000 Tapes Offsite"
echo "\t\tQ. Quit"
echo "\n\t-------------------------------------------\n"
echo "\tPlease Enter Your Selection ..\b\b\c"
read ANS

case $ANS in
1) CHECK_DAILY_IN
Cont
;;
2) CHECK_DAILY_OUT
Cont
;;
3) CHECK_WIN2000_IN
Cont
;;
4) CHECK_WIN2000_OUT
Cont
;;
5) CHECK_FROZEN_IN
Cont
;;
6) CHECK_FROZEN_OUT
Cont
;;
7) CHECK_W2K_FROZEN_IN
Cont
;;
8) CHECK_W2K_FROZEN_OUT
Cont
;;
q|Q) exit
;;
*) echo "Wrong input..." ; Cont
unset inp
;;
esac
done

-------------------------------------------
sort.awk
{
if ($2 == "pool"){
if (fn =="") close(fn)
fn = $2 $1 # or "file" ++ix
}
print > fn
}

----------------------------------------------
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top