Backup and Restore : Run custom backup scripts
  
Run custom backup scripts
onQ supports to ability to run custom backup scripts. You can use custom backup scripts to automate any number of tasks, including the ability to quiesce an application or database for backup.
(Agent‑based PNs) To quiesce an application or database for backup:
To quiesce an application or database for backup without manual intervention, simply use pre‑snap and post‑snap scripts:
For Windows PNs, you can define batch file scripts that run automatically before and after the HA creates a VSS snapshot.
For Linux PNs, you can define shell scripts that run automatically before and after the HA creates a backup. If, for example, your pre‑snap script shuts down your database so as to back up the database, the database remains down until the post‑snap script executes the startup process.
You can do so on a per‑protected‑node basis by saving your scripts to the PN, then registering them with the HA.
If you want to run these same scripts on all protected nodes, you must repeat the procedure below for each protected node.
1. Create two scripts with the following names, specifying the commands that you want executed.
pre_snap.bat and post_snap.bat. For Windows, click here to download .bat placeholder files to quiesce a DB2 database. In this example, each of the batch files in turn executes .clp scripts. These .clp scripts quiesce the DB2 database before the snapshot starts and again after the snapshot completes. After you create/install these scripts, they are not overwritten during a PN upgrade.
pre_snap.sh and post_snap.sh: For Linux, these placeholder files were saved to the destination you chose during the installation. The default location is /opt/quorum/bin. These scripts are not overwritten during a PN upgrade.
2. Log on to the PN and save these scripts to:
(Windows) \Program Files\Quorum\usr folder.
(Linux) the destination you chose during the installation. Usually, /opt/quorum/bin/ is the preferred directory.
3. Log on to the HA’s onQ Portal.
4. Stop protection.
5. From the PROTECTION CONFIG tab, select the protected node from the table, then MODIFY > ADVANCED.
6. Enable the pre and post snapshot scripts on that node:
Select the Execute Pre Snapshot script?: Yes radio button.
Select the Execute Post Snapshot script?: Yes radio button.
The pre-snapshot script is pre_snap, and the post snapshot script is post_snap.
7. Initiate a backup of the PN from the onQ Portal and verify the results.
(Agent‑less PNs) To quiesce an application or database for backup:
To quiesce an application or database for backup without manual intervention, simply use pre‑freeze and post‑thaw scripts:
1. Download and unzip the example scripts. There are two folders, one for Windows and another for Linux. Each folder contains sample scripts.
2. Create pre-freeze-script.bat and post-thaw-script.bat files, specify the commands that you want executed.
3. Do one of the following, depending on the PN’s operating system:
(Windows) Save the pre-freeze-script.bat and the post-thaw-script.bat files under one of the following locations:
C:\Program Files\VMware\VMwaretools\backupscript.d\ folder. When using this path, both the pre and the post scripts can be combined as in the pre-freeze-n-post-thaw.bat example script.
C:\WINDOWS folder on the Protected Node.
(Linux):
Save the pre-freeze-script.bat and the post-thaw-script.bat files under /usr/sbin of the Protected Node.
Make scripts executable (chmod +x <script>).
4. Initiate a backup of the PN from the onQ Portal to verify the results.
(Agent‑less PNs) To make dynamic disks available for backup:
VMware doesn't support dynamic disks: the VSS Writers metadata on which onQ depends isn’t available from the ESXi host. Therefore, to ensure that onQ can back up the dynamic disks, use a freeze and thaw script to install VSSWriterData.exe.
1. Download the example script (vmwQuorum.bat).
2. Log on to the PN and save vmwQuorum.bat to C:\Program Files\VMware\VMware tools\backupscripts.d\.
3. From the onQ Portal, initiate a backup of the PN to verify the results.