cancel
Showing results for 
Search instead for 
Did you mean: 

bpstart_notify script issues - NBU 6.5

yve0603p
Level 3

Hi

Wonder if anyone can help.

We have a bpstart_notify script which isnt working.  When I run from the command prompt to see where it is failing I am getting:

if "" == "" goto FAIL

The syntax of the command is incorrect

Now, I'm not a scripting person - this script was copied from another machine but can see that that script isnt working either now!!!

Can someone tell me where I'm going wrong - I thought that leaving the schedule type blank then it would only fail if wasnt a recognised type?!

Grateful for any input.

15 REPLIES 15

Andy_Welburn
Level 6

but looking at the provided ./netbackup/bin/goodies/bpstart_notify.bat, the statement you've provided is incomplete. Is it just a typo?

 

if "%4" == "" goto FAIL

where:

%1 = CLIENT_NAME
%2 = POLICY_NAME
%3 = SCHEDULE_NAME
%4 = SCHEDULE_TYPE, one of the following: FULL, INCR, CINC, UBAK, UARC
%5 = STATUS, always 0
%6 = RESULT_FILE

yve0603p
Level 3

My script has that line but when you run the script from the command line it misses out the %4 bit and just puts ""

 

Btw - I have looked in the goodies folder and dont seem to have the provided netbackup script? Thats why I copied from another machine?

Andy_Welburn
Level 6

from the command line?

yve0603p
Level 3

I'm running the bpstart_notify script file from the command line - to see where the script is failing?

Andy_Welburn
Level 6

as it's not being fed the variable(s) from the job.

Can you provide your script? Maybe someone can see from that where the issue is - unfortunately don't use them as I already mentioned & I'm a *NIX scripting guy not windows!

Are you sure there's actually an issue with the bpstart_notify?

RiaanBadenhorst
Moderator
Moderator
Partner    VIP    Accredited Certified

Hi,

 

Are you running it like this?

 

bpstart_notify.bat variable1 variable2  variable3 variable4

 

Where variable is just some text to pass to the script. And given that the script has a reference to them. Your scripts could actually contain none of those %1, %2, variables/parameters. Those are just there if you want to pass something back to say an email message that you'd like to send, or a log file you'd like to populate.

 

Post your script.

yve0603p
Level 3

Hi

Script is as follows:

@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2004 VERITAS Software Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM bpstart_notify.bat
@REM
@REM   This script is called by NetBackup when bpbkar is started up on the client
@REM   to do a backup or archive.
@REM
@REM This script receives 6 parameters:
@REM   %1 = CLIENT_NAME
@REM   %2 = POLICY_NAME
@REM   %3 = SCHEDULE_NAME
@REM   %4 = SCHEDULE_TYPE, one of the following: FULL, INCR, CINC, UBAK, UARC
@REM   %5 = STATUS, always 0
@REM   %6 = RESULT_FILE
@REM   
@REM   The script must reside in in the same directory as the rest of the NetBackup
@REM   client binaries (install_path\netbackup\bin\bpstart_notify.bat).  
@REM   It must also be executable by the root user.
@REM   Should exit with 0 upon successful completion
@REM
@REM Naming conventions:
@REM   There are three different versions of names that the scripts can use.  
@REM   The start notify script may use one version and the end notify script may use
@REM   another, or they can both use the same version.
@REM  
@REM   Substitute "policy" with the NetBackup policy being used and "sched" with the
@REM   schedule name.  "bpstart" can be substituted with "bpend".
@REM   bpstart_notify.policy.sched.bat
@REM   bpstart_notify.policy.bat
@REM   bpstart_notify.bat  
@REM  
@REM Result files:
@REM   The result file names will be dependant on the script file names.  
@REM   Example:
@REM   Script name:                         Result file name:
@REM   bpstart_notify.policyA.schedB.bat    BPSTART_RES.policyA.schedB
@REM   bpstart_notify.policyB.bat           BPSTART_RES.policyB
@REM   bpend_notify.bat                     BPEND_RES
@REM      
@REM CAUTION: Writing anything to stdout or stderr will cause backup problems.
@REM          Output should be redirected to the results files.
@REM

@REM --------------------------------------------------------------------
@REM main script starts here
@REM This is a simple script that records what kind of backup will be done along
@REM with other relevent information (Client name, policy name, etc) and
@REM appends the information to the results file
@REM --------------------------------------------------------------------

if "%4" == "" goto FAIL

@REM print a generic message
date /t >> bin\BP_RES.txt
time /t >> bin\BP_RES.txt
echo backup/restore started on %1, bpres = %6 >> bin\BP_RES.txt

cd c:\
call BOXI_PRE_BACKUP.bat


if EXIST stop_success.txt (
    date /t >> stop_success.txt
    time /t >> stop_success.txt
    echo 0 > %6
    GOTO :CLEANUP
    
)ELSE (
    echo 1 > %6
)

GOTO :EOF
@REM exit 0

:CLEANUP
@REM rename the stop_success.txt control file for the next job run
del stop_success.txt /F /Q
GOTO :EOF
@REM exit 0

:FAIL
@REM no schedule type information was sent.  A failure has occured.  Write status 1 to results files.
echo1 >> %6
GOTO :EOF
@REM exit 0

 

Hope this helps - its a Windows box by the way

RiaanBadenhorst
Moderator
Moderator
Partner    VIP    Accredited Certified

Hi,

 

Thanks. Just add 6 variables after the name of the script when you run it

 

bpstart_notify.bat 1 2 3 4 5 6

 

Should work fine :)

yve0603p
Level 3

Sorry

Im a dunce when it comes to scripting.....so where do I add 1 2 3 4 5 6?  I already have the policy name after the bpstart_notify.

RiaanBadenhorst
Moderator
Moderator
Partner    VIP    Accredited Certified

LOL, don't worry, took me a while to figure it out as well.

 

All those % thingies are passed to a script in the order that they're numbered. So when netbackup calls/starts/executes the script it basically says run the script and here are the parameters to use

%1 = CLIENT_NAME
%2 = POLICY_NAME
%3 = SCHEDULE_NAME
%4 = SCHEDULE_TYPE, one of the following: FULL, INCR, CINC, UBAK, UARC
%5 = STATUS, always 0
%6 = RESULT_FILE

 

It populates these for you so say for instance you simply add a line that says echo %1 %2 %3 %4 %5 %6 you'll get output somewhere (console or log file) that says

 

jhbsrvsql1 jhbsrvsql1_sqlonline Daily_SQL FULL 0 log.result (or whatever)

 

Now in most cases you can simply run a script, unless it specifically looking for input (the % thingies). In your case it has that FAIL statement so when it doesn't recieve %4, it fails. All you need to do is give it upto 4 variables. You simply stick these behind the file name (bpstart_notify) when you execute it form the command line. It doesn't need to be real variable, hence me saying add 1 2 3 4 5 6.

 

Understand?

 

Other option.... Just @REM out that FAIL statement :)

yve0603p
Level 3

Kind of!!

I @REM the comment cos thought that was the easiest thing in the end but I just ran again this morning and still getting a 73 error?

Could this be a problem with the script that bpstart_notify calls rather than a problem with bpstart_notify? Any suggestions on how to find out where the problem is?

Does my script look correct?

RiaanBadenhorst
Moderator
Moderator
Partner    VIP    Accredited Certified

Hmmm,

 

I think you should take out the @REM before exit 0 in each of those sections :CLEANUP , :FAIL , and GOTO :EOF

yve0603p
Level 3

Nope still failed :(

I just dont know what I'm doing wrong!!!!

RiaanBadenhorst
Moderator
Moderator
Partner    VIP    Accredited Certified

Open command prompt, change to netbackup\bin on the client, then run

bpstart_notify.bat 1 2 3 4

 

Copy the output and send it to me.

Also send me the contents of the other script that is called from within bpstart.

yve0603p
Level 3

I'm just getting the guy who wrote the script to have a look 1st to see if anything obvious I'm missing!!!