Veritas-bu

[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:
#!/bin/ksh

#Default Hours since backup was written to tape
HOURSWRITE=168

#Hours within the tape will expire and be reusable
HOURSEXP=12

#Hours within the tape has not been read
HOURSREAD=24

PROGNAME=`basename $0`
TMPFILE1=/tmp/$PROGNAME.1.$$
TMPFILE2=/tmp/$PROGNAME.2.$$

PATH=$PATH:/usr/openv/netbackup/bin:/usr/openv/netbackup/bin/admincmd:/usr/o
penv/volmgr/bin:/usr/openv/local

#call my little C program to get current time in epoch seconds
now=`seconds_since_epoch`

# 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`
do
  awk '$2=="'$tape'" {print}' $TMPFILE2
done | sort

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

exit

-----Original Message-----
From: Timothy Arnold [mailto:timothy.arnold AT becta.org 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
criteria.


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?

Thanks,
Timothy.

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

**********************************************************************
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.
www.mimesweeper.com
**********************************************************************


_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu

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