Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pre-backup and Post -backup scripts.

Status
Not open for further replies.

mbonastre

Technical User
Jan 21, 2002
17
ES
Hi;
I have a NetBackup BusinessServer 4.5 at Windows2000 Server.
It is possible to configure the backup in order to run a pre-backup script and a post-backup script?
For example, I want to stop the SQL services before the backup starts, backup the databases and finally restart the SQL services. How can I configure this?

Thanks.
Regards.
 
From my recollection - BusinessServer and DataCentre are the same for start and end scripts. Check what the name of your backup policy is (Your backup job).

Create netbackup\bin\bpstart_notify.your_policy_name.bat and copy in ...
@REM this script is called by NetBackup when a backup is initiated
@REM this script:
@REM receives 4 parameters, clientname, classname, schedname and schedtype
@REM must be executable by a user with Administrator rights
@REM should exit with 0 upon successful completion
@REM
@REM If this script will not complete within a few seconds, you should set
@REM the BPSTART_TIMEOUT in the NetBackup configuration gui on the server.
@REM You should also be aware that the time taken by this script will delay
@REM the initiation of other client's backups.
@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 - HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions
@REM -
@REM - It should be set to 0x1 or you may have problems running this script.
@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="yourdrive\temp\bpstart_your_policy_name.txt"
@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
@echo "This is a start_notify script" > %OUTF%
@REM
@REM Unremark the following line and add you batch file, command file etc.
net stop &quot;MSSQLServer&quot; >> %OUTF% <<==The service may be different.

Create netbackup\bin\bpend_notify.your_policy_name.bat and paste in ...

@@REM this script is called by NetBackup when a backup has completed
@REM
@REM this script:
@REM receives 5 parameters,
@REM CLIENTNAME, CLASSNAME, SCHEDNAME, SCHEDTYPE and STATUS
@REM must be executable by a user with Administrator rights
@REM should exit with 0 upon successful completion
@REM
@REM If this script will not complete within a few seconds, you should set
@REM the BPSTART_TIMEOUT in the NetBackup configuration gui on the server.
@REM You should also be aware that the time taken by this script will delay
@REM the initiation of other client's backups.
@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 - HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\EnableExtensions
@REM - It should be set to 0x1 or you may have problems running this script.
@REM
@setlocal ENABLEEXTENSIONS
@set LISTPATHS=&quot;%~dp0\goodies\listpaths&quot;
@for /F &quot;delims=|&quot; %%p in ('%LISTPATHS% /s NB_MAIL_SCRIPT') do @set NB_MAIL_SCRIPT=&quot;%%p&quot;
@set OUTF=&quot;your_drive\temp\bpend_your_policy_name.txt&quot;
@REM
@REM - Get date and time.
@for /F &quot;tokens=1*&quot; %%p in ('date /T') do @set DATE=%%p %%q
@for /F %%p in ('time /T') do @set DATE=%DATE% %%p
@ECHO &quot;This is an end notify script&quot; > %OUTF%
@REM unremark the following line and call your command file, batch file etc...
net start &quot;MSSQLServer&quot; >> %OUTF%

You can add anything else such as stopping and then starting Anti Virus software etc to these scripts.

If this post was helpful - Please mark it as such so that others may benefit from it.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top