Content requirements for pre-scripts and post-scripts
The pre-script and post-script content must be in text format with a maximum size of 20 KB. The maximum number of scripts that a
PowerProtect Data Manager server supports is 10,000. A maximum of one pre-script and one post-script can run with a backup on UNIX or Windows.
Each script must return the exit code 0 to indicate success. Other exit codes can depend on the particular script and environment. Ensure that the exit codes and corresponding message strings (if available) are logged in the log file.
The pre-scripts and post-scripts can also perform operations based on the input parameters specified for the scripts. The following examples show the use of input parameters with a pre-script and post-script.
Parameters used with a pre-script
The following parameters are provided in this order to a pre-script that runs on an SAP HANA agent host on Linux:
Script Name — Specifies the name of the pre-script — Example: pre_script_stop_database_45362.sh
Operation Type — Specifies the type of operation performed — Example: backup
Job ID — Specifies the agent service session ID — Example: 45362
Backup Level — Specifies the level of backup — Example: log
Asset Name — Specifies the name of the asset — Example: mdc
Policy name — Specifies the name of the protection policy — Example: test-saphana-plc
OS type — Specifies the type of OS where the script is run — Example: Linux
App Type — Specifies the application type — Example: SAPHANA_DATABASE
The following sample pre-script uses the provided parameters to stop an SAP HANA database on Linux:
#!/bin/bash
# Declare variables
script_name=$1
operation_type=$2
job_id=$3
backup_level=$4
asset_name=$5
policy_name=$6
os_type=$7
app_type=$8
mdc="MDC" # Modify this according to your environment
instance="00" # Modify this according to your environment
hostname="blrv003c140.blr.lab.emc.com"
username="SYSTEM"
password="Admin123"
systemdb="SYSTEMDB"
database_name="JAN"
# Execute the first hdbsql command to check the ACTIVE_STATUS of the JAN database
output=$(/usr/sap/$mdc/HDB$instance/exe/hdbsql -n $hostname -i $instance -u $username -p $password -d $systemdb -x "SELECT ACTIVE_STATUS FROM M_DATABASES WHERE DATABASE_NAME='$database_name';")
# Check if the output contains "YES"
if [[ $output == *"YES"* ]]; then
echo "The $database_name database is already active."
exit 0
else
echo "The $database_name database is not active. Starting it now..."
# Execute the second hdbsql command to start the JAN database
/usr/sap/$mdc/HDB$instance/exe/hdbsql -n $hostname -i $instance -u $username -p $password -d $systemdb -x "ALTER SYSTEM START DATABASE $database_name;"
fi
Parameters used with a post-script
The following parameters are provided in this order to a post-script that runs on an SAP HANA agent host on Linux:
Script Name — Specifies the name of the post-script — Example: post_script_start_database_45362.sh
Operation Type — Specifies the type of operation performed — Example: backup
Job ID — Specifies the agent service session ID — Example: 45362
Backup Level — Specifies the level of backup — Example: log
Asset Name — Specifies the name of the asset — Example: mdc
Policy name — Specifies the name of the protection policy — Example: test-saphana-plc
OS type — Specifies the type of OS where the script is run — Example: Linux
App Type — Specifies the application type — Example: SAPHANA_DATABASE
Job Status — Specifies the status (SUCCESS or FAILURE) of the protection job — Example: SUCCESS
Pre Script Status — Specifies the status (0, 1, -1) of pre-script job — Example: 0
The following sample post-script uses the provided parameters to start an SAP HANA database on Linux:
#!/bin/bash
# Input parameters
script_name=$1
operation_type=$2
job_id=$3
backup_level=$4
asset_name=$5
policy_name=$6
os_type=$7
app_type=$8
mdc="MDC" # Modify this according to your environment
instance="00" # Modify this according to your environment
hostname="blrv003c140.blr.lab.emc.com"
username="SYSTEM"
password="Admin123"
systemdb="SYSTEMDB"
database_name="JAN"
# Execute the first hdbsql command to check the ACTIVE_STATUS of the JAN database
output=$(/usr/sap/$mdc/HDB$instance/exe/hdbsql -n $hostname -i $instance -u $username -p $password -d $systemdb -x "SELECT ACTIVE_STATUS FROM M_DATABASES WHERE DATABASE_NAME='$database_name';")
# Check if the output contains "YES"
if [[ $output == *"YES"* ]]; then
echo "The $database_name database is active."
# Execute the second hdbsql command to stop the JAN database
/usr/sap/$mdc/HDB$instance/exe/hdbsql -n $hostname -i $instance -u $username -p $password -d $systemdb -x "ALTER SYSTEM STOP DATABASE $database_name;"
else
echo "The $database_name database is not active."
exit 0
fi
Data is not available for the Topic
Please provide ratings (1-5 stars).
Please provide ratings (1-5 stars).
Please provide ratings (1-5 stars).
Please select whether the article was helpful or not.
Comments cannot contain these special characters: <>()\