Veritas-bu

[Veritas-bu] scriptable method to determine volumes needed for a restore?

2004-04-02 09:45:25
Subject: [Veritas-bu] scriptable method to determine volumes needed for a restore?
From: dlogcher AT MIT DOT EDU (Dan Logcher)
Date: Fri, 02 Apr 2004 09:45:25 -0500
Donald_Arsenault AT bankone DOT com wrote:

> 
> Use:
> 
> bpimagelist -U -d mm/dd/yyyy hh:mm:ss  -e mm/dd/yyyy hh:mm:ss  -client <name> 
>  -media

I wrote this perl script to tell me which tapes to pull for offsiting,
but it will work for this as well.  Give it a try and let me know what
you think.

#!/usr/local/bin/perl

require "getopts.pl";

foreach (@ARGV) {
   $args=join(' ',$args,$_);
   $args=~s/^ //g;
   $args=~s/(.*[0-9]) ([0-9])/$1.$2/g;
}
@ARGV=split(/ /,$args);

do Getopts('c:a,s:b,e:c,t');

$bpm="/usr/openv/netbackup/bin/admincmd/bpimagelist";

if (!defined($opt_c) || !defined($opt_s)) {
   print  "Usage: $0 -c <class,class,...> -s <start-date> -e <end-date>\n";
   exit 1;
}

if (! defined($opt_e)) {
   @time=localtime(time);
   $opt_e=sprintf("%02d/%02d/%02d 
%02d:%02d:%02d",$time[4]+1,$time[3],$time[5]-100,$time[2],$time[1],$time[0]);
}

$opt_s=~s/\./ /;
$opt_e=~s/\./ /;
print "Checking for Classes: $opt_c\n";
print "Start time: $opt_s\n";
print "End time  : $opt_e\n\n";

@classes=split(/,/,$opt_c);
foreach $class (@classes) {
#  print "Checking for $class\n";
   @data=`$bpm -media -l -d $opt_s -e $opt_e -class $class`;
   foreach $line (sort @data) {
     ($tape,$host,$ltime,$rest)=split(/ /,$line);
     @time=localtime($ltime);
     $date=sprintf("%02d/%02d/%02d 
%02d:%02d:%02d",$time[4]+1,$time[3],$time[5]-1
00,$time[2],$time[1],$time[0]);
     print "$tape  \t$class($host)    \t$date\n";
   }
   print "\n";
}
print "End of Line\n";
exit;


-- 
-------------------------------------
Dan Logcher  W91-219C ASST UNIX Admin
Massachusetts Institute of Technology
dlogcher AT mit DOT edu         617-324-5800


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