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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script using vmchange to automatically eject tapes 1

Status
Not open for further replies.

gman999

Technical User
Feb 2, 2006
15
GB
I have got VMCHANGE working.

vmchange -res -m ASQXXX -mt DLT2 -v my_offsite_volumes

where ASQXXX is the tape barcode number.


However I would like to create a script which does this automatically every week. I would like the script to only run this on tapes which are FULL, and give the barcodes of the ones it ran the script on.

Any ideas how I can do this?

Thanks
 
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
 
Thanks, that seems to be what I want.

my server is a win2k3 though, so what would be the best way to execute this? convert it to vbscript?
 
'fraid you've got me there, don't know how you would make this windows friendly as i don't know what scripting alternatives are available in the windows world
 
I am in the process of making this windows friendly, however I have one question.

once this script runs, then I can take out the full tapes.

However when I put in any new tapes in the robot, do I need to run vmupdate again??

normally I go to Inventory --> Update --> add new media, and then the new tapes appear in the scratch pool.
 
hi, always run a robot inventory via whichever method is more suitable, every time tapes are changed
 
so when the tapes are changed I should do a inventory after?

is the inventory the same as vmupdate? I'm trying to make this as automated as I can.
 
yes, you must ALWAYS inventory after tape changing; (yes, my vmupdate command in inventorying)..
'fraid i'm not too familiar with NetBackup on Windows in relation to the command line (or severe lack of!); have checked with my Windows colleague and he's always used the GUI for inventorying so either way i don't know how you'd automate this.
 
oh there is a vmupdate in the windows one. I was just checking if that does the inventory. Ok well I could schedule a job for mon with the whole script and then do a vmupdate the day after.
 
Have you tried cygwin to make it windows friendly


a unix emulator for windows.....

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top