Still - to answer your question, and take the slot number thing
into account.
for tape in `vmquery -a -l | awk '$8!="-" && $9!=0
&& $12~/OFFSITE/ {print $1}'`
do
eject $tape
done
The awk selects robotic tapes (field 8), not slot 0 (field 9),
volume pool contains "OFFSITE" (field 12) and prints Volume ID (field
1).
Note - the change from field 11 below to field 12. Field
11 is volume group, not volume pool. Mea Culpa.
The eject function is left as an exercise for now. Note:
it's the "vmchange" command.
Suspicion: the vault options may have this built in - I should
look at that one day.
-M
From:
veritas-bu-bounces AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of Donaldson,
Mark
Sent: Wednesday, December 02, 2009 9:57 AM
To: Reynolds, Susan K.; Veritas-bu AT mailman.eng.auburn DOT edu
Subject: Re: [Veritas-bu] quick eject script
Well - dunno why. Certainly doesn't work that way for me.
> vmoprcmd -d ds | grep Yes
26 hcart3
TLD
Yes 007766 007766 Yes
Yes 0 <<<<
30 hcart3
TLD
Yes 007357 007357 Yes
Yes 0
39 hcart3
TLD
Yes 007195 007195 Yes
Yes 0
> sudo vmquery -m 007766
================================================================================
media
ID:
007766
<<<<<
media
type:
1/2" cartridge tape 3 (24)
barcode:
007766L4
media description: hcart3
volume
pool: Exchange (32)
robot
type: TLD -
Tape Library DLT (8)
robot
number: 1
robot
slot:
114
<<<<<
robot control host: uscobrmfa-ug-50
<snip>
================================================================================
From: Reynolds, Susan K.
[mailto:SReynolds2 AT semprautilities DOT com]
Sent: Tuesday, December 01, 2009 4:58 PM
To: Donaldson, Mark; Veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] quick eject script
If slot=0 then it is in a drive; I did a vmquery on a tape that
was in a drive and that’s what came back
From: Donaldson, Mark [mailto:Mark.Donaldson AT Staples DOT com]
Sent: Tuesday, December 01, 2009 3:55 PM
To: Reynolds, Susan K.; Veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] quick eject script
I think your second step is
in error - a tape in a drive doesn't update the vmquery slot number.
I'd do something like
this…
for tape in `vmquery -rn 0 -l
| awk '$11~/Offsite/ {print $1}`
do
eject routine (lots of
lines)
done
I actually do something much
like this for offsite purposes. My eject_tapes script is 60 lines of code
that looks up the library for a tape given the tape number. If the tape
is in a drive, though, it just errors . I supposed I could query the
library controls for the tape location (see if it's in a drive) but right now I
just eat the error when it occurs.
-M
From: veritas-bu-bounces AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of Reynolds,
Susan K.
Sent: Tuesday, December 01, 2009 3:22 PM
To: Veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] quick eject script
Does anyone have a quick
eject script the logic of which goes something like this:
1. Eject
any tapes in the OFFSITE volume pool if it is in the tape library
2. Ignore
tapes in a drive (vmquery slot number =0)
3. And
email the list of tapes to me with a report title and today’s date
Is there anything quick and
easy out there like that?
Appreciate your help.