Hi, i'm sure i posted this on Tek-tips before, but a google search turned up this one -
Basically i'll post the relevant parts here -
My Nice and simple 5yr old solution for using the standard available_media script to generate a FULL tapes list (this is run via cron every day; i didn't automate any further, all i do to change the actual tapes is manipulate the output from the script so it has the vmchange command and list of tapes, then the vmupdate command at the end) -
#!/bin/ksh
#
# - first check if NetBackup is running or not.
#
if [ `/usr/openv/netbackup/bin/bpps -a|grep openv|grep -v grep |grep -c openv`
-eq 0 ] ; then echo "This email was generated by script that produces FULL
tapes report - '/home/richardb/full_tapes.sh'" | /usr/ucb/mail -s "NetBackup
doesn't appear to be running - pls investigate ASAP - nthsunbackup @`date
+%d/%m-%H:%M`" emailaddy@somewhere
else
# - if NetBackup is running, ONLY THEN produce report.
#
/usr/openv/netbackup/bin/goodies/available_media > /home/richardb/script-output/all_tapesz.txt
echo > /home/richardb/script-output/full_tapes.txt
echo "A list of FULL UNIX NetBackup tapes to be removed from Tape Robot today
- " >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
date >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
echo "[Remember to re-introduce tapes when expiration is up.]" >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
echo "Eject tapes via" >> /home/richardb/script-output/full_tapes.txt
echo "'vmchange -res -multi_eject -w -verbose -rn 0 -rt tld -rh `hostname`
-vh `hostname` -ml x:y:z'" >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
echo "Also, don't forget to resync the Robot Inventory via " >> /home/richardb/script-output/full_tapes.txt
echo "'vmupdate -rt tld -rn 0 -rh `hostname` -vh `hostname` -use_barcode_rules
-empty_map'" >> /home/richardb/script-output/full_tapes.txt
echo "after any tapes are removed from/re-introduced to Tape Robot." >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
cat /home/richardb/script-output/titlebar2.txt >> /home/richardb/script-output/full_tapes.txt
cat /home/richardb/script-output/all_tapesz.txt | grep "TLD"|grep "FULL"|sort
>> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
cat /home/richardb/script-output/all_tapesz.txt | grep "TLD"|grep "FULL"
| wc | awk '{sum+=$1} END {printf " Total FULL Unix tapes to remove
today = %d\n",sum}' >> /home/richardb/script-output/full_tapes.txt
echo >> /home/richardb/script-output/full_tapes.txt
cat /home/richardb/script-output/full_tapes.txt | /usr/ucb/mail -s "Netbackup
- List of FULL tapes - nthsunbackup @`date +%d/%m-%H:%M`" emailaddy@somewhere
fi
sample output from script -
---------------------------
A list of FULL UNIX NetBackup tapes to be removed from Tape Robot today -
Tue Jun 28 08:30:20 BST 2005
[Remember to re-introduce tapes when expiration is up.]
Eject tapes via
'vmchange -res -multi_eject -w -verbose -rn 0 -rt tld -rh nthsunbackup -vh nthsunbackup -ml x:y:z'
Also, don't forget to resync the Robot Inventory via 'vmupdate -rt tld -rn 0 -rh nthsunbackup -vh nthsunbackup -use_barcode_rules -empty_map'
after any tapes are removed from/re-introduced to Tape Robot.
MediaID Type Robot Type/No Slot/Retention KBytes
------- ---- ------------- -------------- ------
5753L1 HCART TLD 0 51 - 0 287637586 FULL/MPX
5840L1 HCART TLD 0 50 - 0 328209751 FULL/MPX
5916L1 HCART TLD 0 22 - 1 226374572 FULL/MPX
5919L1 HCART TLD 0 53 - 0 290153524 FULL/MPX
5922L1 HCART TLD 0 32 - 0 341916702 FULL/MPX
5934L1 HCART TLD 0 11 - 0 314948025 FULL/MPX
5939L1 HCART TLD 0 4 - 0 307094552 FULL/MPX
5941L1 HCART TLD 0 18 - 2 207328768 FULL
Total FULL Unix tapes to remove today = 8
Rich