cancel
Showing results for 
Search instead for 
Did you mean: 

Create list of media with expiry date of current date

Steve_Alston
Not applicable
I am running netbackup on Solaris 9 and I need to create a list of all media (not images) that have an expiry date of the current date via a script.

Any obvious ideas?

Steve Alston
3 REPLIES 3

Deepak_Bhalwank
Level 5
Hi,
Here is perl script. You will have to add just line to the script. It will be $Rem + or - time in seconds of the offset of your local timezone from GMT. For example IST is +5.30 so i will convert this to seconds and substract it from this $Rem variable.

#!/usr/bin/perl
$Epoch = time();
system("/usr/openv/netbackup/bin/admincmd/bpmedialist -mlist -l > $Epoch");
open(FILE,$Epoch) or die "Cannot open file: $!";

$Rem = $Epoch % 86400;
#$Rem = $Rem (+ or -) offset from GMT in seconds
$Start = $Epoch - $Rem;
$End = $Start + 86400;

while(){
$Line = $_;
chomp $Line;
@Array = split (/\s/,$Line);

if($Start <= $Array and $End >= $Array){
$Time = localtime($Array);
print "$Array expires today on $Time.\n";
}
}
unlink $Epoch;



Br,
Deepak.Message was edited by:
Deepak Bhalwankar

Stumpr2
Level 6
Deepak,
Congrats on your recen promotion to "Enthusiast"

Steve,
reward those that provide scripts. It helps others to see that there is valuable information in the post.

Bob Stump

Deepak_Bhalwank
Level 5
Hi ALL,
Thanks a Lot BOB!
Your comments are as good as points.

Br,
Deepak.