Command Line Tool Overview
Command Line Tool
This feature allows the user to configure a pre-backup or post-backup command which can be an operating system level command, a script, or batch file, or third-party utilities to run before and/or after a backup job.
Example: Connecting a network drive an disconnecting a network drive, stopping a third-party database (not officially supported by Ahsay) to perform a cold backup, and restarting a third-party database after a backup.
Requirements and Best Practices
Error and Exception Handling
Each pre-backup command or batch file should have an error and exception handling. If a pre-backup command contains an error, although an unhandled error may not hinder the backup job process, and the backup is successful, it will result in a status indicating completed backup job with warning(s). For more details about backup report status, refer to the Reports section.
Command or Batch File Compatibility
Make sure that each command (pre-backup and post-backup) are tested thoroughly before including them in the backup job.
Scheduled Backup
If the scheduled backup job is set to stop after x no. of hours, make sure that the duration of the running backup job will not be affected. You may need to adjust the number of hours in the backup schedule configuration. Please refer to the Backup Scheudle section for more details.
Pre-Backup Command Limitation
A Windows reboot or shutdown must not be used in the pre-backup command. Otherwise, the machine will shut down immediately that will result in a status indicating "Backup not yet finished", which can be viewed in the AhsayCBS User Web Console. Please refer to the AhsayCBS Guide for more details.
Post-Backup Command Recommendation
It is recommended to include a timeout for a post-backup command to shut down the machine. The timeout must be adjusted until when AhsayOBM sends the backup job status to AhsayCBS.
In this example, the configured post-backup command is to shut down the machine that has a timeout set to ninety (90) seconds. The machine will shut down automatically after the specified time.
This is to ensure that AhsayOBM has enough time to complete the backup process in order to send the backup job status to AhsayCBS before the machine shuts down. See screenshot below:
There are three (3) fields in the command line tool:
Field | Description |
---|---|
Name | The user-defined name of the pre-backup or post-backup command. |
Working Directory | The location in the local machine which the pre-backup or post-backup command will run at, or the location of the command or created batch file. |
Command | The pre-backup or post-backup command which can be defined as a native command or command to execute a batch file, command, or a VBScript (exclusively for Windows). |
Pre-Backup Command
A pre-backup command is used to execute an action or process before the start of a backup job. To create a pre-backup command, follow the steps below:
Click the + button.
Assign a desired name to the pre-backup command.
Click the Change button to locate the working directory of the command.
Input a command to be run before a backup job. In this example, the pre-backup command will connect to a network drive before the backup process.
- Click the OK button to save the created pre-backup comman, then click the Save button to save the settings.
Once the backup job is complete, click the search button to display the backup report log where you can check if the pre-backup command has run successfully.
Post-Backup Command
A post-backup command is used to execute an action or process after a backup job. To create a post-backup command, follow the steps below:
Click the + button.
Assign a desired name to the post-backup command.
Click the Change button to locate the working directory of the command.
Input a command to be run after a backup job. In this example, the post-backup command will disconnect a network drive after the backup process.
- Click the OK button to save the created post-backup command, then click the Save button to save the settings.
Once the backup job is complete, click the search button to display the backup report log where you can check if the post-backup command has run successfully.
- Multiple pre-backup and post-backup commands can be created in the Command Line Tool.
- Errors from pre-backup and post-backup commands will only be flagged as a warning and will not cause an error. The warning may be viewed in the logs.
- To trigger a job warning, pre-backup and post-backup commands must output a message to stderror. It is not possible to cause a job "Error" message to be logged.