Veritas-bu

[Veritas-bu] RE: [NBUADV-L] Failed Job Notification

2002-09-27 12:08:04
Subject: [Veritas-bu] RE: [NBUADV-L] Failed Job Notification
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Fri, 27 Sep 2002 10:08:04 -0600
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C26640.0F478280
Content-Type: text/plain;
        charset="iso-8859-1"

I use a slightly modified version of the backup_exit_notify script for this.

$ cat /usr/openv/netbackup/bin/backup_exit_notify
#!/bin/sh
# $Header: backup_notify,v 1.0 2002/01/22 1l:44:00 integ Exp $

#
# backup_notify
#
# NOTE:  this script will always be run in "background" mode, meaning that
#        the NetBackup scheduler will NOT wait for it's completion.
#
# This script:
#       receives 5 parameters:
#         CLIENT           - the client hostname
#         CLASS            - the class label
#         SCHEDULE         - the schedule label
#         SCHEDULE_TYPE    - the type of schedule:  FULL INCR UBAK UARC
#         STATUS           - the backup status for this job
#         STREAM           - the backup stream number for this job
#       must be executable by the root user
#       should exit with 0 upon successful completion

LOGFILE=/usr/openv/netbackup/logs/history.log
MAILADDR=YOU AT DOMAIN DOT COM

PATH=$PATH:/usr/openv/netbackup/bin:/usr/openv/volmgr/bin:/usr/local/bin
PATH=$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local
export PATH

echo "`date +%D_%T` $*" | sed 's/  *$//' | tr -s ' ' ',' >>$LOGFILE

       CLIENT=$1
        CLASS=$2
     SCHEDULE=$3
SCHEDULE_TYPE=$4
       STATUS=$5
       STREAM=$6

shortname=`echo $CLIENT| cut -f1-2 -d'.'`
subjectline="RC=$STATUS $CLASS:$SCHEDULE $shortname"

if [ $STATUS -ne 0 -a $STATUS -ne 1 ]
then
  mailx -s "$subjectline" $MAILADDR <<-EOF
      Date=`date`
    Client=$CLIENT
     Class=$CLASS
  Schedule=$SCHEDULE
Sched type=$SCHEDULE_TYPE
    Status=$STATUS
    Stream=$STREAM

Error Description:
`bperror -S $STATUS -r`

EOF

fi

exit

-----Original Message-----
From: Egan, Michael [mailto:michael.egan AT jostens DOT com]
Sent: Friday, September 27, 2002 8:55 AM
To: 'nbu-lserv AT dsihost-srv01 DOT com'
Subject: [NBUADV-L] Failed Job Notification


Is there a way to have a notification sent to me when a job ends with a
status other than 0 or 1?

Thanks,
Michael
_______________________________________________
NBU-LSERV AT datastaff DOT com - Advanced NetBackup Scripting Maillist
http://dsihost-srv01.com/mailman/listinfo/nbu-lserv
Check out the Advanced Scripting Website
http://www.NetBackupCentral.com
 

------_=_NextPart_001_01C26640.0F478280
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [NBUADV-L] Failed Job Notification</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>I use a slightly modified version of the =
backup_exit_notify script for this.</FONT>
</P>

<P><FONT SIZE=3D2>$ cat =
/usr/openv/netbackup/bin/backup_exit_notify</FONT>
<BR><FONT SIZE=3D2>#!/bin/sh</FONT>
<BR><FONT SIZE=3D2># $Header: backup_notify,v 1.0 2002/01/22 1l:44:00 =
integ Exp $</FONT>
</P>

<P><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># backup_notify</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># NOTE:&nbsp; this script will always be run in =
&quot;background&quot; mode, meaning that</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the =
NetBackup scheduler will NOT wait for it's completion.</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># This script:</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; receives 5 =
parameters:</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
CLIENT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - =
the client hostname</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
CLASS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
- the class label</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
SCHEDULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - the schedule =
label</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
SCHEDULE_TYPE&nbsp;&nbsp;&nbsp; - the type of schedule:&nbsp; FULL INCR =
UBAK UARC</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - =
the backup status for this job</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
STREAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - =
the backup stream number for this job</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; must be =
executable by the root user</FONT>
<BR><FONT SIZE=3D2>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; should exit =
with 0 upon successful completion</FONT>
</P>

<P><FONT =
SIZE=3D2>LOGFILE=3D/usr/openv/netbackup/logs/history.log</FONT>
<BR><FONT SIZE=3D2>MAILADDR=3DYOU AT DOMAIN DOT COM</FONT>
</P>

<P><FONT =
SIZE=3D2>PATH=3D$PATH:/usr/openv/netbackup/bin:/usr/openv/volmgr/bin:/us=
r/local/bin</FONT>
<BR><FONT =
SIZE=3D2>PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local=
</FONT>
<BR><FONT SIZE=3D2>export PATH</FONT>
</P>

<P><FONT SIZE=3D2>echo &quot;`date +%D_%T` $*&quot; | sed 's/&nbsp; =
*$//' | tr -s ' ' ',' &gt;&gt;$LOGFILE</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
CLIENT=3D$1</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
CLASS=3D$2</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; SCHEDULE=3D$3</FONT>
<BR><FONT SIZE=3D2>SCHEDULE_TYPE=3D$4</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
STATUS=3D$5</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
STREAM=3D$6</FONT>
</P>

<P><FONT SIZE=3D2>shortname=3D`echo $CLIENT| cut -f1-2 -d'.'`</FONT>
<BR><FONT SIZE=3D2>subjectline=3D&quot;RC=3D$STATUS $CLASS:$SCHEDULE =
$shortname&quot;</FONT>
</P>

<P><FONT SIZE=3D2>if [ $STATUS -ne 0 -a $STATUS -ne 1 ]</FONT>
<BR><FONT SIZE=3D2>then</FONT>
<BR><FONT SIZE=3D2>&nbsp; mailx -s &quot;$subjectline&quot; $MAILADDR =
&lt;&lt;-EOF</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date=3D`date`</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; Client=3D$CLIENT</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp; Class=3D$CLASS</FONT>
<BR><FONT SIZE=3D2>&nbsp; Schedule=3D$SCHEDULE</FONT>
<BR><FONT SIZE=3D2>Sched type=3D$SCHEDULE_TYPE</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; Status=3D$STATUS</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; Stream=3D$STREAM</FONT>
</P>

<P><FONT SIZE=3D2>Error Description:</FONT>
<BR><FONT SIZE=3D2>`bperror -S $STATUS -r`</FONT>
</P>

<P><FONT SIZE=3D2>EOF</FONT>
</P>

<P><FONT SIZE=3D2>fi</FONT>
</P>

<P><FONT SIZE=3D2>exit</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Egan, Michael [<A =
HREF=3D"mailto:michael.egan AT jostens DOT com">mailto:michael.egan AT jostens 
DOT com=
</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Friday, September 27, 2002 8:55 AM</FONT>
<BR><FONT SIZE=3D2>To: 'nbu-lserv AT dsihost-srv01 DOT com'</FONT>
<BR><FONT SIZE=3D2>Subject: [NBUADV-L] Failed Job Notification</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Is there a way to have a notification sent to me when =
a job ends with a</FONT>
<BR><FONT SIZE=3D2>status other than 0 or 1?</FONT>
</P>

<P><FONT SIZE=3D2>Thanks,</FONT>
<BR><FONT SIZE=3D2>Michael</FONT>
<BR><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>NBU-LSERV AT datastaff DOT com - Advanced NetBackup =
Scripting Maillist</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://dsihost-srv01.com/mailman/listinfo/nbu-lserv"; =
TARGET=3D"_blank">http://dsihost-srv01.com/mailman/listinfo/nbu-lserv</A=
></FONT>
<BR><FONT SIZE=3D2>Check out the Advanced Scripting Website</FONT>
<BR><FONT SIZE=3D2><A HREF=3D"http://www.NetBackupCentral.com"; =
TARGET=3D"_blank">http://www.NetBackupCentral.com</A></FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C26640.0F478280--

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