Quantcast
Channel: Data Protector Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3189

eject media admin guide example script not working

$
0
0

Hi, sorry if thi is old question but i searched acould nt find

I have setup the eject media after x hours as per admin guide examole

i.e.

create reportgorup that lists media used to bat file and email

create endof sesion event to evoke report group

copied andpasted script

 

email is receviced with correct list of media used attached

perlscript execute but says "no media found to eject after x hours"

it ooks as if the parameters are not being passsed to the perl script

the bat filecontains the one line ...

perl.exe "omnirpt_eject.pl"

with no vairable handling

so i  am presuming the perl script picks up the parameters (library and slot) by a different method

(my perlskills are no existent)

all files reside in bin directory

 

please hep! am I missing something

my OS is windows 2008 r2

dp version 8.0

 

is there a permissions execution problem? or do i have to modify the copy and pasted script?

 

I have attahced script for refernce.....

#!/usr/contrib/bin/perl
 
#=================================================================================
# FUNCTION Library_Eject
#
# ARGUMENTS param 1 = Library to eject from
# param 2 = Slots to eject
#
# DESCRIPTION Function ejects specified slots from specified library
#=================================================================================
 
sub Library_Eject {
  local ($lib,$slots)=@_;
  print "[Normal] Ejecting slot(s) ${slots}from library \"$lib\"\n";
  print("[Normal] Executing  \"${OMNIBIN}omnimm\" -eject \"$lib\" $slots\n");
  $report =`"${OMNIBIN}omnimm" -eject \"$lib\" $slots 2>&1`;
  #print "\debug>\n$report\n<debug\n";
  if ($report !~/Final report: (\d+) cartridges out of (\d+) successfully ejected\./) {
    print "[Critical] Eject has failed!\n\nReport:\n$report\n";
    return (1);
  }
  print "$report\n";
  if ($1 ne $2) {
    print "[Warning] Not all media successfully ejected!\n";
    return (2);
  }
  print "[Normal] Eject from library \"$lib\" successfully completed.\n";
  return (0);
}
 
 
#=================================================================================
# FUNCTION Eject
#
# ARGUMENTS none
#
# DESCRIPTION Function for each library in %List call Library_Eject
#=================================================================================
 
sub Eject {
  local ($lib,$slot,$result);
  while (($lib, $slot) = each(%List)){
    $result |=&Library_Eject($lib,$slot);
  }
  if ($result) {
    return (1);
  } else {
    print "[Normal] All operations successfully completed.\n";
    return (0);
  }
}
 
 
#=================================================================================
# FUNCTION Omnirpt
#
# ARGUMENTS none
#
# DESCRIPTION Function get slots to eject from omnirpt report
#=================================================================================
 
sub Omnirpt {
  @lines =STDIN;
  for ($i=5;$i<@lines;$i++){
  @line =split(/\t/,$lines[$i]);
  if ($line[2] =~/^\[([\w:\-\s]+):\s+(\w+)\]/){
  $List{$1}.=$2.' '; # $1= "Library name", $2= "Slot ID"
  }
  }
  if (!keys(%List)) {
  print "[Warning] No tape(s) to eject.\n";
  return (1);
  }
  return (0);
 
}
 
 
#------------------------------------------------------------------------
# MAIN
#------------------------------------------------------------------------
 
  if ($ENV{"OS"}=~/Windows_NT/) { # Windows
  $OMNIBIN ='c:\\program files\\omniback\\bin\\';
  } else {
  local($uname)=`uname -a`;
  chop $uname;
  @uname=split(' ', $uname);
  if ($uname[0]) {
  if ($uname [0] eq 'HP-UX' || $uname [0] eq 'SunOS') {
  $OMNIBIN ='/opt/omni/bin/';
  } else {
  $OMNIBIN ='/usr/omni/bin';
  }
  } else {
  exit (1);
  }
  }
 
  print "[Normal] Starting eject of media that have been used in the last x hours.\n";
 
  exit (0) if (&Omnirpt());
  exit (1) if (&Eject());


Viewing all articles
Browse latest Browse all 3189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>