08-10-2011 03:17 AM
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.
08-10-2011 03:33 AM
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
08-10-2011 03:37 AM
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?
08-10-2011 03:40 AM
from the command line?
08-10-2011 03:49 AM
I'm running the bpstart_notify script file from the command line - to see where the script is failing?
08-10-2011 03:56 AM
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?
08-10-2011 04:06 AM
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.
08-10-2011 04:38 AM
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
08-10-2011 04:55 AM
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 :)
08-10-2011 06:37 AM
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.
08-10-2011 06:52 AM
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 :)
08-11-2011 02:40 AM
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?
08-11-2011 02:58 AM
Hmmm,
I think you should take out the @REM before exit 0 in each of those sections :CLEANUP , :FAIL , and GOTO :EOF
08-11-2011 04:09 AM
Nope still failed :(
I just dont know what I'm doing wrong!!!!
08-11-2011 04:47 AM
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.
08-11-2011 05:42 AM
I'm just getting the guy who wrote the script to have a look 1st to see if anything obvious I'm missing!!!