no Mail notification after policy status 1
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?
Comments
I don't have to know how to spell....I work on Unix.
NetBackup 7.0.1 - AIX & Windows
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
yes, it works. but it works then only with policy status 1. i want to have this with both, 1 and 0.
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
thanks randy, i will try it and post here the result.
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
@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?
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?
nobody knows it?
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
(C) Copyright 1985-2001 Microsoft Corp.
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
the command only if the condition is false.
returned an exit code equal to or greater than the number
specified.
match.
exists.
met. Command can be followed by ELSE command which
will execute the command after the ELSE keyword if the
specified condition is FALSE
example:
del filename.
) ELSE (
echo filename. missing.
)
by a newline:
as the end of the IF command:
ELSE echo filename. missing
IF CMDEXTVERSION number command
IF DEFINED variable command
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal
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.
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.
environment variable name and returns true if the environment variable
is defined.
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:
:answer0
echo Program had return code 0
:answer1
echo Program had return code 1
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.
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.
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
thanks a lot. i will try it.
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
Bob Stump VERITAS - "Ain't it the truth?" Incorrigible punster -- Do not incorrige
@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 -
@REM - @call %NB_MAIL_SCRIPT% someone_who_cares "NetBackup backup exit" %OUTF%
@REM ---------------------------------------------------------------------------
sorry, but i do not really understand, what do you want to say to me.
can you explain it a little bit please?
ruffy
another proposal?
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!
Would you like to reply?
Login or Register to post your comment.