[Veritas-bu] Scripting ejection of tapes based on search crit eria.

2003-07-11 15:18:59
Subject: [Veritas-bu] Scripting ejection of tapes based on search crit eria.
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Fri, 11 Jul 2003 13:18:59 -0600
Here's my tool for almost what you're asking.  I searches for in-library
tapes that meet certain timing requirements.  It used an external call to a
little C routine that returns the unix time integer.  You can use the
previously posted PERL routine for similar.

It was written to identify tapes in the library that were candidates for
removal to make space for new tapes.  The tape has to be full, frozen, or
suspended and meet certain timing requirements - you don't want to pull
something just written to & don't want to pull a tape partially full that
may yet be appended to, etc.  These timers are set as variables in the top
of the script so you can change them to whatever you want.

If you don't want to worry about tape location, you can delete all the
sections built around vmquery.

Feel free to modify:

#Default Hours since backup was written to tape

#Hours within the tape will expire and be reusable

#Hours within the tape has not been read

PROGNAME=`basename $0`


#call my little C program to get current time in epoch seconds

# Get scrach pool number
spname=`vmpool -listscratch | tail -1`
 spnum=`vmpool -listall | \
         awk '{if ($2=="number:") {pnum=$3}
               if ($2=="name:" && $3=="'$spname'") {print pnum}}'`

#get list of media & filter
bpmedialist -l -mlist | \
  awk 'BEGIN {  now='$now'
            write='$HOURSWRITE' * 3600
           expire='$HOURSEXP' * 3600
             read='$HOURSREAD' * 3600
           scpool='$spnum' }
     {if ( $13!=$scpool      && \
           now>=$6+write     && \
           now<=$7-expire    && \
           now>=$8+read      && \
          ( int($15/8)%2==1  || \
                $15%2==1     || \
            int($15/2)%2==1 )) {print $1}}' > $TMPFILE1

#TMPFILE1 contains a list of matching tapes regardless
#of location so now sort to in-library stuff

vmquery -a -w | awk '$8!="-" {print $8"\t"$1}' >$TMPFILE2

echo "Robot\tTape\n-----\t------"
for tape in `cat $TMPFILE1`
  awk '$2=="'$tape'" {print}' $TMPFILE2
done | sort

[ -f $TMPFILE1 ] && rm $TMPFILE1
[ -f $TMPFILE2 ] && rm $TMPFILE2


-----Original Message-----
From: Timothy Arnold [mailto:timothy.arnold AT DOT uk]
Sent: Friday, July 11, 2003 3:27 AM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Scripting ejection of tapes based on search

Morning all!

I have a question about 'bpmedialist -mlist -l'. I would like to search for
tapes that are Active/Full/Frozen or Suspended that will not expire within
the next 24 hours. I know that bpmedialist -mlist -l contains the
information for when the tape was last written to and when it will expire
but have no idea how to decode the timestamp information.

Any ideas?


Timothy Arnold, Server & Network Infrastructure Support Officer, Internet
Becta, Coventry, CV4 7JJ, UK                      Voice: +44 24 7684 7169
email: timothy.arnold AT DOT uk                Fax:   +44 24 7641 

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu

<Prev in Thread] Current Thread [Next in Thread>