cancel
Showing results for 
Search instead for 
Did you mean: 

no Mail notification after policy status 1

ruffy
Level 4
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?
22 REPLIES 22

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

Stumpr2
Level 6


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.
 
 

 

ruffy
Level 4

@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.

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

Randy_Samora
Level 6
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.

Stumpr2
Level 6
thanks Randy!
 
 

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

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

ruffy
Level 4
@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
Level 4
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
Level 4
nobody knows it?

Stumpr2
Level 6
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.
 
 

sdo
Moderator
Moderator
Partner    VIP    Certified
In a DOS cmd box, use:
help if

Stumpr2
Level 6
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>

Stumpr2
Level 6
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 Smiley Very Happy
 
 

ruffy
Level 4
thanks a lot. i will try it.

ruffy
Level 4
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

Stumpr2
Level 6
call symantec support
 
 

David_Kies
Level 4
Certified
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 ---------------------------------------------------------------------------