Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
ARNEL-101 Valued Contributor.
Valued Contributor.
381 views

HP Dataprotector 9.08 - PRE and POST Backup Script Batch files - Step by Step walk through

Jump to solution

Hi guys, 

I been stuck in an activity that I am engage into.

Setup: HP Dataportector 9.08 Environment Cell Manager, Servers and Clients are all Windows Based. 

Task Execute a Batch File Script for both PRE-Exec Script and POST-Exec Script backup activity.

Implementation:

Script Location:  Location of our "Bin" folder at  E:\Program Files\OmniBack\bin\Customs-Utils

"Pre.bat"  (Manually run and works perfectly on CLI)

:Primary
Rem "This batch script is to simulate HP DP Script Pre Excution feature possibility - Created January 30, 2019
@echo On
echo 1, FILE_System Backup-MICROSOFT RIGHTS MANAGEMENT Service, %date%, %time%, Backup Started >> "E:\Program Files\OmniBack\bin\Customs-Utils\Primary.csv"
Goto End

:End
Exit /B

=====

"Post.bat"  (Manually run and works perfectly on CLI)

:Primary
Rem "This batch script is to simulate HP DP Script Pre Excution feature possibility - Created January 30, 2019
@echo On
echo 1, FILE_System Backup-MICROSOFT RIGHTS MANAGEMENT Service, %date%, %time%, Backup Ended >> "E:\Program Files\OmniBack\bin\Customs-Utils\Primary.csv"
Goto End

:End
Exit /B

 

=====

Cell Manager View in configuring the Script.

PRE.jpg

 

Session Report:

[Normal] From: BSM@Contoso.microsoft.com "Bill-Gates-Files" Time: 2/5/2019 6:03:54 PM
Backup session 2019/02/05-237 started.

[Normal] From: BSM@Contoso.microsoft.com "Bill-Gates-Files" Time: 2/5/2019 6:03:56 PM
Starting to execute "E:\Program Files\OmniBack\bin\Customs-UTILS\PRE.bat"...

[Critical] From: BSM@Contoso.microsoft.com "Bill-Gates-Files" Time: 2/5/2019 6:03:56 PM
[61:2012] Session pre-exec script E:\Program Files\OmniBack\bin\Customs-UTILS\PRE.bat failed. Exit code = 2 The session will not start.

[Critical] From: BSM@Contoso.microsoft.com "Bill-Gates-Files" Time: 2/5/2019 6:03:56 PM
None of the Disk Agents completed successfully.
Session has failed.

[Normal] From: BSM@Contoso.microsoft.com "Bill-Gates-Files" Time: 2/5/2019 6:03:56 PM

Backup Statistics:

 

Questions:

1. I have encountered the issue on the Session Report, anyone can give me some light what am I doing wrong?

Exit code = 2 The session will not start.

2.  Is there any HP DataProtector configuration on both GLOBAL Settings or GLOBAL File I need to check or modify in order this issue be resolved?

3. The script is been tested and proven working on the manual running the script. What am I forgetting on the part of the DP?, I believed the issue is on DP not on the script.

Regards, 

0 Likes
1 Solution

Accepted Solutions
ARNEL-101 Valued Contributor.
Valued Contributor.

Re: HP Dataprotector 9.08 - PRE and POST Backup Script Batch files - Step by Step walk through

Jump to solution

Hello Brothers,

I came across to a behavior maybe by DataProtector Design.  I found out that on the documents stated in the below procedure. 

1. Creat Script (Batch File) - Done 

2. Test Script manually - Done

3. Save the Script Either on the DP Home-- BIN Folder or Create a custom Folder - Done

4. Set the Script name and the Script Path, on the "Backup Specificaion Option" --"Advance" Settings (Look below sample). - Done

5. Run the backup and observed the Session Log. - Done

Windows systems:

Pre- and post-exec scripts for a backup object are started under the Data
Protector Inet Service account (by default, the local system account).
The exec scripts for backup objects can reside in any directory on the system
where the Disk Agent is running. However, for client backups, they must reside in
Data_Protector_home\bin (This is the easiest thing to do just save the script in BIN folder, but doing this your file will mixed up with DtaProtector Binaries not  a good practice).

By deafault I think the DataPortector is Hard Coded the script location to ""DATA_PROTECTOR_HOME\bin\" folder therefore only provide the script name as long as the script is save in the BIN folder.

Image2.jpg

......If the scripts are located in the Data_Protector_home\bin, specify only the  filename, otherwise the full pathname must be specified (The FULL PATH name will make an error against your script and it will not run).

For Example: I have created a separate folder "Customs-UTILS" for better script management and placed it under the BIN Folder and will look like this  ""DATA_PROTECTOR_HOME\bin\Customs-UTILS", thin save your script in the customs_utils folder.

Image4.jpg

Regards,

0 Likes
3 Replies
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: HP Dataprotector 9.08 - PRE and POST Backup Script Batch files - Step by Step walk through

Jump to solution

Hi,,

This is the explanation of your error:

https://www.tutorialspoint.com/batch_script/batch_script_return_code.htm

2

The system cannot find the file specified. Indicates that the file cannot be found in specified location.

 

 

Please review the syntax used. Below you can see some advices from the Administrator's Guide - Chapter 9.

Pre- and Post-Exec Commands for a Backup Specification


Pre- and post-exec commands can be written as executables or batch files on Windows systems, or as
shell scripts on UNIX systems. All the commands that run within the batch file must return an exit code
0 to signify success or greater than 0 to signify a failure.
Pre- and Post-exec characteristics
l Start-up and location of the commands
l Environment variables
l SMEXIT values
l Considerations for pre- and post-exec commands
Start-up and location of the commands
Pre- and post-exec commands for a backup session are started before and after the backup session,
respectively. They are executed on the Cell Manager by default, but you can choose another system.
Windows systems
Pre- and post-exec scripts are started by the Data Protector CRS when executed on the Cell Manager;
and under the Data Protector Inet Service account (by default, the local system account) when
executed remotely.
The scripts must be located in the Data_Protector_home\bin directory or its subdirectory. In the
backup specification, specify the relative filename of the script. Don't use the absolute filenames.
Only .bat, .exe, and .cmd are supported extensions for pre- and post-exec commands. To run a script
with unsupported extension (for example, .vbs), create a batch file that starts the script. Then
configure Data Protector to run the batch file as a pre- or post-exec command, which then starts the
script with the unsupported extension.
If you use quotes ("") to specify a pathname, do not use the combination of backslash and quotes (\"). If
you need to use a trailing backslash at the end of the pathname, use the double backslash (\\).
Note: The direct usage of perl.exe is prohibited.

 

Pre- and Post-exec Commands for a Specific Backup Object


Pre- and post-exec commands can be written as executables or batch files on Windows systems and
shell scripts on UNIX systems. All the commands that run within the batch file must return an exit code
0 to signify success or greater than 0 to signify a failure.
Start-up and location of the commands Pre- and post-exec commands for an object are executed before and after the backup of the object, respectively. You can specify these commands for all objects in a backup specification, or for each
individual object. When backing up integrations, for example Oracle, the database is considered as an object, so the commands are executed before and after the database backup. These commands are executed on the system where the Disk Agent is running.

Windows systems:


Pre- and post-exec scripts for a backup object are started under the Data
Protector Inet Service account (by default, the local system account).
The exec scripts for backup objects can reside in any directory on the system
where the Disk Agent is running. However, for client backups, they must reside in
Data_Protector_home\bin. If the scripts are located in the Data_Protector_
home\bin, specify only the filename, otherwise the full pathname must be
specified.
Only .bat, .exe, and .cmd are supported extensions for pre- and post-exec
commands. To run a script with unsupported extension (for example, .vbs),
create a batch file that starts the script. Then configure Data Protector to run the
batch file as a pre- or post-exec command, which then starts the script with the
unsupported extension.

Hope this will be useful for to solve your issue,

 

Regards

 

/TR

 

 

ARNEL-101 Valued Contributor.
Valued Contributor.

Re: HP Dataprotector 9.08 - PRE and POST Backup Script Batch files - Step by Step walk through

Jump to solution

Thanks for the response let me check this and will come back to the results.

 

0 Likes
ARNEL-101 Valued Contributor.
Valued Contributor.

Re: HP Dataprotector 9.08 - PRE and POST Backup Script Batch files - Step by Step walk through

Jump to solution

Hello Brothers,

I came across to a behavior maybe by DataProtector Design.  I found out that on the documents stated in the below procedure. 

1. Creat Script (Batch File) - Done 

2. Test Script manually - Done

3. Save the Script Either on the DP Home-- BIN Folder or Create a custom Folder - Done

4. Set the Script name and the Script Path, on the "Backup Specificaion Option" --"Advance" Settings (Look below sample). - Done

5. Run the backup and observed the Session Log. - Done

Windows systems:

Pre- and post-exec scripts for a backup object are started under the Data
Protector Inet Service account (by default, the local system account).
The exec scripts for backup objects can reside in any directory on the system
where the Disk Agent is running. However, for client backups, they must reside in
Data_Protector_home\bin (This is the easiest thing to do just save the script in BIN folder, but doing this your file will mixed up with DtaProtector Binaries not  a good practice).

By deafault I think the DataPortector is Hard Coded the script location to ""DATA_PROTECTOR_HOME\bin\" folder therefore only provide the script name as long as the script is save in the BIN folder.

Image2.jpg

......If the scripts are located in the Data_Protector_home\bin, specify only the  filename, otherwise the full pathname must be specified (The FULL PATH name will make an error against your script and it will not run).

For Example: I have created a separate folder "Customs-UTILS" for better script management and placed it under the BIN Folder and will look like this  ""DATA_PROTECTOR_HOME\bin\Customs-UTILS", thin save your script in the customs_utils folder.

Image4.jpg

Regards,

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.