Here's a little bit of code to get you started.
Alex
#!/bin/ksh
#
# This is a simple script to process vault slotting for ADSM DR Media
# The slot file has to be generated first, and looks something like
#
# A001 -Empty
# A002 -Empty
#
#
#set -x
function usage {
print
print "usage: vault [-r|-v] file1 file2"
print "usage: vault [-o|-e] file2"
print "usage: vault [-s] string file2"
print
print -- "-r return from vault"
print -- "-v send to vault"
print -- "-o print contents of slots"
print -- "-c free slot count"
print -- "-s search slots for a string"
print -- "-e edit the slot list"
print "string search string"
print "file1 filename of the list of tapes to send or return"
print "file2 filename of the list of slots"
}
function unslot_tapes {
tapes=$1
slots=$2
grep -f $tapes $slots | awk '{print $1" -Empty"}' > slots.empty
grep -vf $tapes $slots > slots.unchanged
cat slots.empty >> slots.unchanged
awk '{print $1}' slots.empty > tmp3.$$
grep -f tmp3.$$ $slots
rm tmp3.$$
sort +0 -1 slots.unchanged > $slots
rm slots.unchanged
}
function slot_tapes {
tapes=$1
slots=$2
grep -f $tapes $slots > slots.vaulted
awk '{print $2}' slots.vaulted > tmp.$$
grep -vf tmp.$$ $tapes > tapes.2
grep -vf tmp.$$ $slots > tmp2.$$
cat tmp2.$$ > $slots
rm tmp2.$$
rm tmp.$$
exec 3< tapes.2
grep "\-Empty" $slots | awk '{print $1}' | while read slotnum; do
if read -u3 volume; then
print "$slotnum $volume "`date +"%m/%d/%y"` >> slots.vaulted
else
break;
fi
done
awk '{print $1}' slots.vaulted > tmp.$$
grep -vf tmp.$$ $slots > slots.unchanged
rm tmp.$$
cat slots.vaulted >> slots.unchanged
sort +0 -1 slots.unchanged > $slots
rm tapes.2 slots.unchanged
cat slots.vaulted
}
if [[ ! $# -gt 1 ]]; then
usage
return 1
elif [[ $1 = "-c" ]]; then
if [[ ! -s $2 ]]; then print "unable to open file $2"; return 1; fi
grep -c "\-Empty" $2
elif [[ $1 = "-o" ]]; then
if [[ ! -s $2 ]]; then print "unable to open file $2"; return 1; fi
grep -v "\-Empty" $2 2>/dev/null
elif [[ $1 = "-e" ]]; then
if [[ ! -s $2 ]]; then print "unable to open file $2"; return 1; fi
vi $2
elif [[ ! $# -eq 3 ]]; then
usage
return 1
elif [[ $1 = "-s" ]]; then
if [[ ! -s $3 ]]; then print "unable to open file $3"; return 1; fi
grep $2 $3 2>/dev/null
if [[ ! $? -eq 0 ]]; then
print "Unable to find pattern"
return 1
fi
elif [[ ! ( -s $2 && -s $3 ) ]]; then
print "one of the files, $2 or $3, doesn\'t exist."
return 1
elif [[ $1 = "-r" ]]; then
unslot_tapes $2 $3
elif [[ $1 = "-v" ]]; then
slot_tapes $2 $3
fi
-----Original Message-----
From: Adam J. Boyer [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 02, 2001 2:00 PM
To: [EMAIL PROTECTED]
Subject: Re: vaulting problem
We will be assigned a range of slots. We tell them what tapes to put in
what slots, so it's under our control -- but we also have to keep track.
David Longo
<David.Longo@HEALTH- To: [EMAIL PROTECTED]
FIRST.ORG> cc:
Sent by: "ADSM: Dist Subject: Re: vaulting
problem
Stor Manager"
<[EMAIL PROTECTED]
U>
08/02/01 04:52 PM
Please respond to
"ADSM: Dist Stor
Manager"
BTW: How will you know what slot they have put your tape in??
David B. Longo
System Administrator
Health First, Inc.
3300 Fiske Blvd.
Rockledge, FL 32955-4305
PH 321.434.5536
Pager 321.634.8230
Fax: 321.434.5525
[EMAIL PROTECTED]
"WorldSecure <Freightliner.com>" made the following
annotations on 08/03/01 10:30:09
------------------------------------------------------------------------------
[INFO] -- Content Manager:
The information contained in this communication is confidential and intended solely
for the use of the individual to whom it is addressed and others authorized to receive
it. If you are not the intended recipient, any disclosure, copying, distribution or
taking of any action in reliance on the contents of this information is prohibited. If
you have received this communication in error, please immediately notify the sender by
phone if possible or via email message.
==============================================================================