How to run pre-backup and post-backup commands on agent-based systems protected by asset level backups using the Unitrends agent.
A pre-backup command will call a custom script originating from the server where the backup will be taken, generated for unsupported applications such as a MySQL database.
The custom script must return "0" to indicate that the script was successfully run. Any other exit code will indicate that the custom script failed, and this will result in the backup being marked failed.
Note: Post-backup commands DO NOT execute if a backup failed prior to reaching the end of the system data set or failed during other post-backup operations. For this reason using pre and post commands for support of 3rd party databases or other critical system functions is not recommended as this may leave your system in an inoperable state at conclusion of backup.
Pre-backup and Post-Backup commands can be created or edited within the job inventories settings by choosing "Edit" then navigating to the "Advanced" tab.
The full path to that script will be put into the field "Command to run Pre-Backup" or "Command to run Post-Backup" as illustrated below. This should be a path in Unitrends install directory tree. C:/PCBP on windows or /usr/bp on most other platforms.
Though Unitrends does support the inclusion of pre and post commands, Unitrends cannot assist in the creation, editing, or troubleshooting of such scripts. Any such scripted use would be for the protection of products Unitrends itself does not officially support protection of. Please work with the application or database vendor you need to use scripting with for any process review or troubleshooting.
Any pre/post commands should take not more than 10 minutes to complete execution. If more time is required, adjustment of this can only be accommodated on some operating systems (Windows, some Linux, and Netware). Information about how to do this for Linux clients is noted in Pre-Backup and Post-Backup Command Timeouts for Linux Clients The Legacy Admin Guide also contains more information about the beforeCmdWaitTime and afterCmdWaitTime variables.
Due to execution time lints, Unitrends recommends pre and post commands for simple tasks like notifications, quiesce of a database (setting it to a ready state for online backups), or suspension/stop of service, but we do not recommend these processes to launch other backup operations that could take extended time. If you have a system or database that requires additional dump operations using scripting, those should be scheduled and ensured to be complete prior to Unitrends independent backup operation, and not tied to our launch with pre or post commands.