Skip to content

Instantly share code, notes, and snippets.

@michaelcoyote
Created August 15, 2014 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelcoyote/1c578c922b0a37d9845a to your computer and use it in GitHub Desktop.
Save michaelcoyote/1c578c922b0a37d9845a to your computer and use it in GitHub Desktop.
Remeber when we had to eject actual media from jukeboxes? This is one of those for NetWorker
#!/usr/bin/perl
#
# used to populate the location field in the NetWorker Volume Database
$location="OffSite";
#
# what is the name of our jukebox
$jb="scalar2000";
#
# how far back to catch offsite tapes. this should cover a long weekend.
$time="last week";
#
# the query string for our mminfo query
$mmq="!incomplete, savetime < $time";
#
# place pools here to be ejected daily
@pools=("OffsiteDaily","CelerraDailyOffsite","DisasterRecoveryOffsite");
foreach $pool (@pools) { # iterate through out list of pools
#
# are we iterating through properly?
#print ("DEBUG - pool: $pool\n ");
#
# open mminfo and query for
open (MMVOL, "mminfo -xc, -r volume -q \"pool=$pool\" -q \"$mmq\"|") or die ("unable to open mminfo: $!") ;
#
#temp array hack to load the @mmvol array
@mmvol=<MMVOL>;
#
# Unload mminfo query for pool into @mmvol array
push (@mmvol, @mmtmp );
}
foreach $vol (@mmvol) { #iterate through volumes
#
# remove trailing cr
chomp($vol);
#
# Set the location field in the volume db
system ("mmlocate -u -n $vol $location");
#
# eject tapes from jukebox
system ("nsrjb -j $jb -w $vol");
#
# Test iteration
print "\n Ejecting $vol from $jb";
}
#print "\nPress 'Enter' to continue";
#<>; # wait for user to press enter
#print "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment