cancel
Showing results for 
Search instead for 
Did you mean: 

BPSTART & BPEND for use with Enterprise Vault Backups

paynet
Level 3
I am new to these scripts, so be nice...  I need to use the BPSTART to change the Enterprise Vault environment to Read only so I can back it and the SQL server up.  The BPEND changes it back to Readwrite.  Where would these scripts go?  On the EV client or on a NB Master/Media Server?  Does anyone know of any sample script for this type of requirmement?  I stink at scripting so any help would be appreciated.  I am on a Windows 2003 environment.
6 REPLIES 6

GuruPrasadNS
Level 4

symantec has a generic script called evopmode.bat for EV upto 7.5 version. this should be under \program files\enterprise vault\ folder with details specific to your environment. call this script from bpstart_notify and bpend_notify batch files which will be used in NBU. evopmode puts EV in to read only mode and readwrite mode.

sdo
Moderator
Moderator
Partner    VIP    Certified
Both of the subsequently posted scripts go in: z:\Program Files\VERITAS\NetBackup\bin I suggest you have a separate backup policy just to backup the EV indices, and thus the bpstart and bpend scripts would be named: bpstart_notify.MY_POLICY_NAME.bat ...and: bpend_notify.MY_POLICY_NAME.bat N.B. *WARNING* If toy decide to modify these scripts then you *MUST* ensure that they do *NOT* cause any output to be written - i.e. do not echo anything or use any commands that might display output - this is because any data (text/characters) written to stdout by the script is passed back to the parent job as "data" and thus back to the media server which in turn - at best causes the backup to fail - at worst corrupts your backup but leaves the backup completing successfully. *AND* I have found that NBU ES v6.5.2 does not submit multiple streams in a reguar fashion. With NBU v4.5 and v5.x then the first entry in the file selection list would always be stream 1 and would always execute first. This is no longer the case. Symantec refuse to accept this as either a bug or an undocumented feature change. So - if your EV indices are spread over several NTFS volumes, then do *NOT* use multi-streaming because stream one no longer executes first! Sighs. Anyway... scripts to be posted in a sec...

sdo
Moderator
Moderator
Partner    VIP    Certified
@echo off setlocal enabledelayedexpansion REM ################################################################################################# REM # File: bpstart_notify.bat REM # Purpose: Script is run with wait at the start of every NetBackup stream. REM # REM # Vers Date Who Notes REM # ---- ---- --- ----- REM # v0.01 9-NOV-2008 DR First draft. REM # v0.02 26-NOv-2008 DR Check for expected client and streams. REM # v0.03 17-FEB-2009 DR Configure for SEVPR1. REM # v0.04 19-FEB-2009 DR Added routines to stop and start PatrolAgent service. REM # v0.05 20-FEB-2009 DR Modified for non-streamed job, thus no STREAM_* variables. REM # v0.06 3-MAR-2009 DR Disabled stop and start of PatrolAgent. REM ################################################################################################# set z_path=%~dp0 set z_name=%~n0 set z_log=!z_path!!z_name!.log set z_tmp=!z_path!!z_name!.tmp set z_expected_client=sevpr1 set z_expected_streams=1 set z_evopmode=D:\Program Files\Enterprise Vault\EVOPMODE.bat call :log "" call :log "" call :log "-------------------START--------------------" call :log "Date time: !date! !time:~0,8!" call :log "Client: %~1" call :log "Policy: %~2" call :log "Sched Name: %~3" call :log "Sched Type: %~4" call :log "Status: %~5" call :log "Results File: %~6" call :log "Stream Number: !STREAM_NUMBER!" call :log "Stream Count: !STREAM_COUNT!" call :log "Stream PID: !STREAM_PID!" call :log "" if /i not "%~4"=="full" ( goto :err_not_full ) if /i not "%~1"=="!z_expected_client!" ( goto :err_not_cluster ) if /i not "%~5"=="0" ( goto :err_backup_not_successful ) REM if /i not "!stream_count!"=="!z_expected_streams!" ( REM goto :err_not_correct_streams REM ) REM if /i "!stream_number!"=="1" ( if not exist "!z_evopmode!" goto :err_evopmode_missing REM call :patrol stop REM if /i "!z_error!"=="y" goto :err_patrol_stop_failed call :log "Calling EVOPMODE READONLY..." call "!z_evopmode!" READONLY >> "!z_log!" set z_sts=%errorlevel% call :log "Return status is: `!z_sts!`" if /i not "!z_sts!"=="0" ( if /i not "!z_sts!"=="9009" ( goto :err_evopmode_failed ) ) REM call :patrol start REM if /i "!z_error!"=="y" goto :err_patrol_start_failed REM ) else ( REM call :log "No action taken for stream `!stream_number!`..." REM ) call :log "Informing parent job of success, by writing status 0 to results file..." echo 0 > "%~6" call :log "---------SUCCESS---------" exit /b 0 :patrol set z_action=%~1 set z_service=PatrolAgent set z_exists=N set z_error=N if exist "!z_tmp!" del "!z_tmp!" call :log "Attempting `!z_action!` for service `!z_service!`..." net !z_action! "!z_service!" >> "!z_log!" call :log "Status `!errorlevel!`..." net start >> "!z_tmp!" for /f "tokens=*" %%a in ('type "!z_tmp!"') do ( if /i "%%a"=="!z_service!" set z_exists=Y ) call :log "Does service exist: `!z_exists!`..." if /i "!z_action!"=="STOP" ( if /i "!z_exists!"=="Y" ( call :log "Failed to stop service `!z_service!`..." set z_error=Y goto :eof ) ) else ( if /i "!z_exists!"=="N" ( call :log "Failed to start service `!z_service!`..." set z_error=Y goto :eof ) ) if /i "!z_exists!"=="Y" call :log "Service `!z_service!` is running..." if /i "!z_exists!"=="N" call :log "Service `!z_service!` is stopped..." goto :eof REM ##################################################### REM # Reasons to quit, but not abort... REM # :quit_exit call :log "Informing parent job of success, by writing status 0 to results file..." echo 0 > "%~6" call :log "---------QUIT------------" exit /b 0 REM ##################################################### REM # Reasons to quit AND abort... REM # :err_not_full call :log "Unexpected schedule type not full, aborting..." goto :err_exit :err_not_cluster call :log "Not a backup of expected client name `!z_expected_client!`, assuming this is a plain client backup, aborting..." goto :err_exit :err_not_correct_streams call :log "Not part of a `!z_expected_streams!` stream job, assuming this is a test or re-run, aborting..." goto :err_exit :err_evopmode_missing call :log "The EVOPMODE script could not be found at `z_evopmode`, aborting..." goto :err_exit :err_evopmode_failed call :log "The call to EVOPMODE failed, aborting..." goto :err_exit :err_patrol_stop_failed call :log "Failed to stop the Patrol service..." goto :err_exit :err_patrol_start_failed call :log "Failed to start the Patrol service..." goto :err_exit :err_backup_not_successful call :log "The backup was not successful, aborting..." goto :err_exit :err_exit call :log "Informing parent job of failure, by writing status 999 to results file..." echo 999 > "%~6" call :log "---------FAILURE---------" exit /b 0 REM ##################################################### REM # Sub-routines... REM # :log echo !date! !time:~0,8! !z_name:~0,14! %~1 >> "!z_log!" goto :eof @REM $Id: bpstart_notify.bat,v 1.3 2006/08/01 20:46:43 $ @REM *************************************************************************** @REM * $VRTScprght: Copyright 1993 - 2008 Symantec 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 --------------------------------------------------------------------

sdo
Moderator
Moderator
Partner    VIP    Certified
@echo off setlocal enabledelayedexpansion REM ################################################################################################# REM # File: bpend_notify.bat REM # Purpose: Script is run with wait at the end of every NetBackup stream. REM # >>> BUT, if the job is multi-plexed then this job is NOT waited for. REM # REM # Vers Date Who Notes REM # ---- ---- --- ----- REM # v0.01 9-NOV-2008 DR First draft. REM # v0.02 26-NOv-2008 DR Check for expected client and streams. REM # v0.03 17-FEB-2009 DR Configure for SEVPR1. REM # v0.04 19-FEB-2009 DR Added routines to stop and start PatrolAgent service. REM # v0.05 20-FEB-2009 DR Modified for non-streamed job, thus no STREAM_* variables. REM # v0.06 3-MAR-2009 DR Disabled stop and start of PatrolAgent. REM ################################################################################################# set z_path=%~dp0 set z_name=%~n0 set z_log=!z_path!!z_name!.log set z_tmp=!z_path!!z_name!.tmp set z_expected_client=sevpr1 set z_expected_streams=1 set z_evopmode=D:\Program Files\Enterprise Vault\EVOPMODE.bat call :log "" call :log "" call :log "-------------------START--------------------" call :log "Date time: !date! !time:~0,8!" call :log "Client: %~1" call :log "Policy: %~2" call :log "Sched Name: %~3" call :log "Sched Type: %~4" call :log "Status: %~5" call :log "Results File: %~6" call :log "Stream Number: !STREAM_NUMBER!" call :log "Stream Count: !STREAM_COUNT!" call :log "Stream PID: !STREAM_PID!" call :log "" if /i not "%~4"=="full" ( goto :err_not_full ) if /i not "%~1"=="!z_expected_client!" ( goto :err_not_cluster ) if /i not "%~5"=="0" ( goto :err_backup_not_successful ) REM if /i not "!stream_count!"=="!z_expected_streams!" ( REM goto :err_not_correct_streams REM ) REM if /i "!stream_number!"=="!stream_count!" ( if not exist "!z_evopmode!" goto :err_evopmode_missing REM call :patrol stop REM if /i "!z_error!"=="y" goto :err_patrol_stop_failed call :log "Calling EVOPMODE READWRITE..." call "!z_evopmode!" READWRITE >> "!z_log!" set z_sts=%errorlevel% call :log "Return status is: `!z_sts!`" if /i not "!z_sts!"=="0" ( if /i not "!z_sts!"=="9009" ( goto :err_evopmode_failed ) ) REM call :patrol start REM if /i "!z_error!"=="y" goto :err_patrol_start_failed REM ) else ( REM call :log "No action taken for stream `!stream_number!`..." REM ) call :log "Informing parent job of success, by writing status 0 to results file..." echo 0 > "%~6" call :log "---------SUCCESS---------" exit /b 0 :patrol set z_action=%~1 set z_service=PatrolAgent set z_exists=N set z_error=N if exist "!z_tmp!" del "!z_tmp!" call :log "Attempting `!z_action!` for service `!z_service!`..." net !z_action! "!z_service!" >> "!z_log!" call :log "Status `!errorlevel!`..." net start >> "!z_tmp!" for /f "tokens=*" %%a in ('type "!z_tmp!"') do ( if /i "%%a"=="!z_service!" set z_exists=Y ) call :log "Does service exist: `!z_exists!`..." if /i "!z_action!"=="STOP" ( if /i "!z_exists!"=="Y" ( call :log "Failed to stop service `!z_service!`..." set z_error=Y goto :eof ) ) else ( if /i "!z_exists!"=="N" ( call :log "Failed to start service `!z_service!`..." set z_error=Y goto :eof ) ) if /i "!z_exists!"=="Y" call :log "Service `!z_service!` is running..." if /i "!z_exists!"=="N" call :log "Service `!z_service!` is stopped..." goto :eof REM ##################################################### REM # Reasons to quit, but not abort... REM # :quit_exit call :log "Informing parent job of success, by writing status 0 to results file..." echo 0 > "%~6" call :log "---------QUIT------------" exit /b 0 REM ##################################################### REM # Reasons to quit AND abort... REM # :err_not_full call :log "Unexpected schedule type not full, aborting..." goto :err_exit :err_not_cluster call :log "Not a backup of expected client name `!z_expected_client!`, assuming this is a plain client backup, aborting..." goto :err_exit :err_not_correct_streams call :log "Not part of a `!z_expected_streams!` stream job, assuming this is a test or re-run, aborting..." goto :err_exit :err_evopmode_missing call :log "The EVOPMODE script could not be found at `z_evopmode`, aborting..." goto :err_exit :err_evopmode_failed call :log "The call to EVOPMODE failed, aborting..." goto :err_exit :err_patrol_stop_failed call :log "Failed to stop the Patrol service, aborting..." goto :err_exit :err_patrol_start_failed call :log "Failed to start the Patrol service, aborting..." goto :err_exit :err_backup_not_successful call :log "The backup was not successful, aborting..." goto :err_exit :err_exit call :log "Informing parent job of failure, by writing status 999 to results file..." echo 999 > "%~6" call :log "---------FAILURE---------" exit /b 0 REM ##################################################### REM # Sub-routines... REM # :log echo !date! !time:~0,8! !z_name:~0,12! %~1 >> "!z_log!" goto :eof @REM $Id: bpend_notify.bat,v 1.3 2006/08/01 20:46:43 $ @REM *************************************************************************** @REM * $VRTScprght: Copyright 1993 - 2008 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 --------------------------------------------------------------------

sdo
Moderator
Moderator
Partner    VIP    Certified
Symantec Enterprise Vault Technical Note Backing up Enterprise Vault in a clustered environment ftp://exftpp.symantec.com/pub/support/products/Exchange_Mailbox_Archiving_Unit/285839.pdf Sample batch file template for use with backing up in a clustered environment http://seer.entsupport.symantec.com/docs/314559.htm

GuruPrasadNS
Level 4

i am trying to call evopmode.bat from bpstart_notify.bat to put EV in readonly mode but backup itself is not starting and failing with "client timed out waiting for bpstart_notify to complete(74)" error. Found bpbkar32".