Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.