Veritas-bu

[Veritas-bu] backup_exit_notify Perl script

2006-10-16 16:03:36
Subject: [Veritas-bu] backup_exit_notify Perl script
From: ddunham at taos.com (Darren Dunham)
Date: Mon, 16 Oct 2006 13:03:36 -0700 (PDT)
> Does anybody have a Perl version of this script that I can look at? I'm
> currently working on my own, but specifically what I'm looking for is a
> way to send only one e-mail per client if multiple streams fail with the
> same error code. I'm sure I can come up with something on my own, but
> with Perl being so pervasive I figure why re-invent the wheel if someone
> has already done it.

No, but I could probably type something close to it real quick...  This
is untested, but should be pretty close.

#!/usr/bin/perl
use strict;
use warnings;

my $datestr = localtime;
my $output = "/usr/openv/netbackup/bin/BACKUP_EXIT_CALLED" ;
if (@ARGV < 6)
{
   open (OUTF, ">>$output");
   print OUTF "$datestr $0 expects at least 6 parameters: @ARGV";
   exit 1;
}

# You may want to delete the output file elsewhere in order to 
# accumulate successful backup information.
# If so, comment out the following 2 lines. 
if (-s $output)
{ unlink $output; }

open (OUTF, ">>$output") or die "Couldn't open $output for writing. $!\n";
print OUTF "$datestr -----------------------------";
print OUTF "$datestr        CLIENT:  $ARGV[0]";
print OUTF "$datestr        POLICY:  $ARGV[1]";
print OUTF "$datestr      SCHEDULE:  $ARGV[2]";
print OUTF "$datestr SCHEDULE TYPE:  $ARGV[3]";
print OUTF "$datestr        STATUS:  $ARGV[4]";
print OUTF "$datestr        STREAM:  $ARGV[5]";
print OUTF "$datestr -----------------------------";

#
# might want to mail this info to someone
#
# system("cat $output | mailx -s 'NetBackup backup exit' someone_who_cares");

exit 0;

Okay, that's the one on the system tranlsated.  It does at least show
the gathering of the data.  You'd probably want to do things quite a bit
different than the way it does...

Good luck!

-- 
Darren Dunham                                           ddunham at taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

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