Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

no Mail notification after policy status 1

Updated: 22 May 2010 | 22 comments
ruffy's picture
0 0 Votes
Login to vote

hi there

i use blat.exe to notification status of backup policy after backup per mail. but i will not to be notificated by backup policy status 1 (partially succussful).

Thats my actual backup_exit_notify.cmd:

@REM
@REM $Header: backup_exit_notify.cmd,v 1.2 2002/11/20 02:10:34 $
@REM
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2006 Symantec Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM backup_exit_notify.cmd
@REM
@REM This script is called by the NetBackup scheduler, after an individual
@REM client backup has completed (including media closure and image db
@REM validation.
@REM
@REM NOTE:  this script will always be run in "background" mode, meaning that
@REM        the NetBackup scheduler will NOT wait for it's completion.
@REM
@REM This script:
@REM    receives 5 parameters:
@REM        %1 = CLIENT           - the client hostname
@REM        %2 = POLICY           - the policy label
@REM        %3 = SCHEDULE         - the schedule label
@REM        %4 = SCHEDULE_TYPE    - the type of schedule:  FULL INCR UBAK
@REM                                                       UARC
@REM        %5 = STATUS           - the backup status for this job
@REM        %6 = STREAM           - the backup stream number for this job
@REM
@REM - Main program ------------------------------------------------------------
@REM -
@REM - This script only runs on NT 4.0 and succeeding versions of NT.  You must
@REM - have command extensions enabled.  Check the following registry entry:
@REM -
@REM - HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions
@REM -
@REM - It should be set to 0x1 or you may have problems running this script.
@REM ---------------------------------------------------------------------------
@setlocal ENABLEEXTENSIONS
@set LISTPATHS="%~dp0\goodies\listpaths"
@for /F "delims=|" %%p in ('%LISTPATHS% /s NB_MAIL_SCRIPT') do @set NB_MAIL_SCRIPT="%%p"
@set OUTF="%~dp0\BACKUP_EXIT_CALLED"
@REM ---------------------------------------------------------------------------
@REM - Get date and time.
@REM ---------------------------------------------------------------------------
@for /F "tokens=1*" %%p in ('date /T') do @set DATE=%%p %%q
@for /F %%p in ('time /T') do @set DATE=%DATE% %%p
@REM ---------------------------------------------------------------------------
@REM - Check for proper parameter use.
@REM ---------------------------------------------------------------------------
@if "%6" == "" goto BadParams
@if "%7" == "" goto GoodParams
:BadParams
@echo %DATE% backup_exit_notify expects 6 parameters: %* >> %OUTF%
@goto EndMain
:GoodParams
@REM ---------------------------------------------------------------------------
@REM - You may want to delete the output file elsewhere in order to
@REM - accumulate successful backup information.  If so, delete the
@REM - following line or move it to where it will do the most good.
@REM ---------------------------------------------------------------------------
@if exist %OUTF% del %OUTF%
@REM ---------------------------------------------------------------------------
@echo %DATE% ----------------------------- >> %OUTF%
@echo %DATE%        CLIENT:  %1 >> %OUTF%
@echo %DATE%        POLICY:  %2 >> %OUTF%
@echo %DATE%      SCHEDULE:  %3 >> %OUTF%
@echo %DATE% SCHEDULE TYPE:  %4 >> %OUTF%
@echo %DATE%        STATUS:  %5 >> %OUTF%
@echo %DATE%        STREAM:  %6 >> %OUTF%
@echo %DATE% ----------------------------- >> %OUTF%
@REM ---------------------------------------------------------------------------
@REM - might want to mail this info to someone
@REM -
f not "%5"=="0" call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%
@REM ---------------------------------------------------------------------------
:EndMain
@endlocal
@REM - End of Main Program -----------------------------------------------------

the row in red i think is for no notification when the status of a backup policy is 0 (successful).

what must i change or insert for my plan?

discussion Filed Under:

Comments

J.Hinchcliffe's picture
17
Oct
2007
0 Votes 0
Login to vote

change "someone_who_cares" to your "email_address"  then see if you are happy with what you get.

I don't have to know how to spell....I work on Unix.
NetBackup 7.0.1 - AIX & Windows

Stumpr's picture
17
Oct
2007
0 Votes 0
Login to vote


ruffy wrote:
f not "%5"=="0" call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%

the row in red i think is for no notification when the status of a backup policy is 0 (successful).
what must i change or insert for my plan?


ruffy,
Are you asking for the syntax to send the email if %5 is less than or equal to 1?
I don't know the syntax.
 
 

 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

ruffy's picture
17
Oct
2007
0 Votes 0
Login to vote

Stumpr wrote:

ruffy,
Are you asking for the syntax to send the email if %5 is less than or equal to 1?
I don't know the syntax.


yes, it works. but it works then only with policy status 1. i want to have this with both, 1 and 0.

Stumpr's picture
17
Oct
2007
0 Votes 0
Login to vote

"%5"=="0"
again I do not know the correct syntax but did you try "%5" <= "1"
less than or equal to 1
 
 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

Randy Samora's picture
17
Oct
2007
0 Votes 0
Login to vote

Add another line beneath the first line identical to the first but change the "0" to "1" and you'll be good to go.  Your script will hit the first line and if it is status 0 it'll do what it's told to do.  If it's not a Status 0, it continues down the script to the next line which informs NetBackup what to do if it's a Status 1.
 
I blocked out Status 0's, 1's and 71's and this is what worked for me.
Stumpr's picture
17
Oct
2007
0 Votes 0
Login to vote

thanks Randy!
 
 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

ruffy's picture
18
Oct
2007
0 Votes 0
Login to vote

thanks randy, i will try it and post here the result.

Stumpr's picture
18
Oct
2007
0 Votes 0
Login to vote

Randy,
In your response about simply adding another line for the different codes; will this result in an email sent for each line?
 
 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

ruffy's picture
19
Oct
2007
0 Votes 0
Login to vote

@randy: i did it so. but i became mails with status partially successful anyway .
my actual sctipt:

@REM ---------------------------------------------------------------------------
@REM - might want to mail this info to someone
@REM -
if not "%5"=="0" call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%
if not "%5"=="1" call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%

@REM ---------------------------------------------------------------------------
:EndMain

this can not be wrong, isnt it?

ruffy's picture
22
Oct
2007
0 Votes 0
Login to vote

or can i say:

if not "%5"=="0" or =="1" call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%


or something like that?

ruffy's picture
24
Oct
2007
0 Votes 0
Login to vote

nobody knows it?

Stumpr's picture
24
Oct
2007
0 Votes 0
Login to vote

ruffy,
 
Again what you are asking is syntax question for arithmetic or logical equivalent to be used in a simple DOS file.
 
research how to use:
equal to
less than
less than or equal to
more than
more than or equal to
more than X but less than Y
 
etc.....
 
You may need to go to a different forum to get the proper syntax.
 
 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

sdw303's picture
24
Oct
2007
0 Votes 0
Login to vote

In a DOS cmd box, use:
help if
Stumpr's picture
24
Oct
2007
0 Votes 0
Login to vote

like this?
 
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Stumpr>help if
Performs conditional processing in batch programs.
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
  NOT               Specifies that Windows XP should carry out
                    the command only if the condition is false.
  ERRORLEVEL number Specifies a true condition if the last program run
                    returned an exit code equal to or greater than the number
                    specified.
  string1==string2  Specifies a true condition if the specified text strings
                    match.
  EXIST filename    Specifies a true condition if the specified filename
                    exists.
  command           Specifies the command to carry out if the condition is
                    met.  Command can be followed by ELSE command which
                    will execute the command after the ELSE keyword if the
                    specified condition is FALSE
The ELSE clause must occur on the same line as the command after the IF.  For
example:
    IF EXIST filename. (
        del filename.
    ) ELSE (
        echo filename. missing.
    )
The following would NOT work because the del command needs to be terminated
by a newline:
    IF EXIST filename. del filename. ELSE echo filename. missing
Nor would the following work, since the ELSE command must be on the same line
as the end of the IF command:
    IF EXIST filename. del filename.
    ELSE echo filename. missing
The following would work if you want it all on one line:
    IF EXIST filename. (del filename.) ELSE echo filename. missing
If Command Extensions are enabled IF changes as follows:
    IF [/I] string1 compare-op string2 command
    IF CMDEXTVERSION number command
    IF DEFINED variable command
where compare-op may be one of:
    EQU - equal
    NEQ - not equal
    LSS - less than
    LEQ - less than or equal
    GTR - greater than
    GEQ - greater than or equal
and the /I switch, if specified, says to do case insensitive string
compares.  The /I switch can also be used on the string1==string2 form
of IF.  These comparisons are generic, in that if both string1 and
string2 are both comprised of all numeric digits, then the strings are
converted to numbers and a numeric comparison is performed.
The CMDEXTVERSION conditional works just like ERRORLEVEL, except it is
comparing against an internal version number associated with the Command
Extensions.  The first version is 1.  It will be incremented by one when
significant enhancements are added to the Command Extensions.
CMDEXTVERSION conditional is never true when Command Extensions are
disabled.
The DEFINED conditional works just like EXISTS except it takes an
environment variable name and returns true if the environment variable
is defined.
%ERRORLEVEL% will expand into a string representation of
the current value of ERRORLEVEL, provided that there is not already
an environment variable with the name ERRORLEVEL, in which case you
will get its value instead.  After running a program, the following
illustrates ERRORLEVEL use:
    goto answer%ERRORLEVEL%
    :answer0
    echo Program had return code 0
    :answer1
    echo Program had return code 1
You can also using the numerical comparisons above:
    IF %ERRORLEVEL% LEQ 1 goto okay
%CMDCMDLINE% will expand into the original command line passed to
CMD.EXE prior to any processing by CMD.EXE, provided that there is not
already an environment variable with the name CMDCMDLINE, in which case
you will get its value instead.
%CMDEXTVERSION% will expand into a string representation of the
current value of CMDEXTVERSION, provided that there is not already
an environment variable with the name CMDEXTVERSION, in which case you
will get its value instead.
C:\Documents and Settings\Stumpr>

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

Stumpr's picture
24
Oct
2007
0 Votes 0
Login to vote

then this may work
 
if not "%5"LEQ"1" call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%
 
I'm sure there must be some windows weenie that is laughing at me :smileyvery-happy:
 
 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

ruffy's picture
25
Oct
2007
0 Votes 0
Login to vote

thanks a lot. i will try it.

ruffy's picture
26
Oct
2007
0 Votes 0
Login to vote

sorry, but it didnt work! i became mail notification with the status 1 again today!
any other ideas?



Message Edited by ruffy on 10-26-2007 12:00 PM

Stumpr's picture
26
Oct
2007
0 Votes 0
Login to vote

call symantec support
 
 

Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige

David Kies's picture
26
Oct
2007
0 Votes 0
Login to vote

Re-stored the passed auguments to something more meaningful ....
hold.txt is just a dummy file so our IronPort doesn't reject a messahge without a body
 
 
 
@if exist %OUTF% del %OUTF%
@REM ---------------------------------------------------------------------------
@echo %DATE% ----------------------------- >> %OUTF%
@echo %DATE%        CLIENT:  %1 >> %OUTF%
@echo %DATE%        POLICY:  %2 >> %OUTF%
@echo %DATE%      SCHEDULE:  %3 >> %OUTF%
@echo %DATE% SCHEDULE TYPE:  %4 >> %OUTF%
@echo %DATE%        STATUS:  %5 >> %OUTF%
@echo %DATE%        STREAM:  %6 >> %OUTF%
@echo %DATE% ----------------------------- >> %OUTF%
@REM ---------------------------------------------------------------------------

@set ADMINS=user1@foo.net,user2@foo.net, andsoon@foo.net
@set DT=%DATE%
@set TI=%TIME%
@set ST=%5%
@set CL=%1%
@set PL=%2%
@set SC=%3%
@set FAIL_TXT=failed.Code
@if %ST% GTR 1 goto BlatFail
@goto EndMain
:BlatFail
@Blat "c:\hold.txt" -s "%CL% %FAIL_TXT% %ST% - %SC%" -t %ADMINS%
@REM - might want to mail this info to someone
@REM -
@REM - @call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%
@REM ---------------------------------------------------------------------------

ruffy's picture
30
Oct
2007
0 Votes 0
Login to vote

sorry, but i do not really understand, what do you want to say to me.

can you explain it a little bit please?

ruffy


ruffy's picture
02
Nov
2007
0 Votes 0
Login to vote

another proposal?

illram's picture
04
Mar
2008
0 Votes 0
Login to vote

Hi Gurus,

What if I want two conditions to satisfy before I could send email notification?

Is the syntax below is the correct one to add in?
if  "%1"=="0" && "%2"=="<policyname>"call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%

If this is not the correct syntax, could someone please enlighten me? This would be very helpful for me.
Thank you all!