Forum Discussion

Anthony_Tsang's avatar
14 years ago
Solved

bplist no output on post-job bpend_notify.bat

Dear all,

 

I have tested my bplist command with correct option  on command prompt of windows 2008R2. The bplist command can output the backup file with size which i was expected. However, i cannot get bplist output when i merge the command into the bpend_notify.bat.

Moreover, i change grant the client's service "Netbackup Client Service" with domain admins prilevge.

CAn anyone tell me what's wrong on my script ?

@REM $Id: bpend_notify.bat,v 1.3 2006/08/01 20:46:43 $
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2009 Symantec Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM bpend_notify.bat
@REM
@REM This script is called by NetBackup when bpbkar is finished doing a
@REM backup on the client. It is also called after backing up the files
@REM for a user directed archive, but before the files are deleted.
@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 of backup
@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\bpend_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.  "bpend" can be substituted with "bpstart".
@REM   bpend_notify.policy.sched.bat
@REM   bpend_notify.policy.bat
@REM   bpend_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   bpend_notify.policyC.bat             BPEND_RES.policyC
@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 was done along
@REM with other relevent information (Client name, policy name, etc) and
@REM appends the information to the results file
@REM --------------------------------------------------------------------
@For /F "Tokens=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%A
@For /F "Tokens=1,2 eol=/ DELIMS=/" %%A IN ('DATE/T') DO SET mm=%%B
@For /F "Tokens=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%A
@For /F "Tokens=2,3 DELIMS=/" %%A IN ('echo %CDATE%') DO SET yyyy=%%B
@Set date=%mm%/%dd%/%yyyy%

@REM backupdate.log saved the date of launching the backup

@For /F "Tokens=1* DELIMS= " %%A IN (C:\temp\backupscript\backupdate.log) DO SET BDATE=%%A

@bplist -C %1 -k %2 -R -b -l -Listseconds -nt_files -s %date% 20:00:00 -e %BDATE% 19:00:00 D:\WMO\ > C:\temp\backupscript\WMO_backupfiles.log
@makecab.exe /d compressiontype=mszip c:\temp\backupscript\WMO_backupfiles.log \\server1\c$\temp\backupscript\WMO.cab

@if "%4" == "FULL" goto FULL
@if "%4" == "CINC" goto CINC
@if "%4" == "" goto FAIL
@REM print a generic message since backup is neither full, nor cumulative incremental
@echo backup/restore finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt
@echo 0 >> %6
@GOTO :EOF
@REM exit 0
:FULL
@echo full backup finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt
@echo 0 >> %6
@GOTO :EOF
@REM exit 0
:CINC
@echo cumulative incremental backup finished on %1 using policy %2 with schedule %3 and status %5, bpres = %6 >> bin\BP_RES.txt
@echo 0 >> %6
@GOTO :EOF
@REM exit 0
:FAIL
@REM no schedule type information was sent.  A failure has occured.  Write status 1 to results files.
@echo 1 >> %6
@GOTO :EOF
@REM exit 0

  • Just add the line below on top of your batch file.

    @SET PATH=C:\Program Files\Veritas\NetBackup\bin

10 Replies

  • it seems for me that the date and time provided to "-s" option is later than that to "-e" option. write full command line to log file and check it. also write stderr output of bplist to log file and check it.
  • HI all,

    I have revised the script in below before. but it has not standard output

    @bplist -C %1 -k %2 -R -b -l -Listseconds -nt_files -s %date% 20:00:00 -s %BDATE% -e %date% D:\WMO\ > C:\temp\backupscript\WMO_backupfiles.log

     

    However, i will try to write stderr to see any output in there.

     

  • Revised the correct in preivous mail

    @bplist -C %1 -k %2 -R -b -l -Listseconds -nt_files -s %BDATE% 20:00:00 -e %date% D:\WMO\ > C:\temp\backupscript\WMO_backupfiles

  • Did it work when you run the bplist command with just hard-coded value instead of variable?

    If so, that might be just the variable values are not correct or correctly formatted. Also I assume you have a %PATH%  included with \netbackup\bin which is for bplist to run.

  • In your script, you run bplist command without specifying PATH environment. Please set PATH or run bplist with full path.
  • Yes it is work when i run the bplist command with just hard-coded value

    The batch file saved in \Netbackup\bin which is the same path of bplist.exe

  • Just add the line below on top of your batch file.

    @SET PATH=C:\Program Files\Veritas\NetBackup\bin

  • Hi,

     

    I have not tried to set path firstly. But, i change to use absolute path in below

    @D:\Program Files\Veritas\Netbackup\bin\bplist ........

    At last, it is still no output to log file.

    Any possible root cause ?

     

  • You have omitted end of time in "-e" option. Please add time in "-e" option, or don't specify "-e" option. Without "-e" option, bplist assume that you specified current date and time as end of time range.

  • After tested by using SET Path, i can view the expected output.

    Thanks!! Yasuhisa Ishikawa

    My fault may be no single  blanket to quote the folder name <Program Files>