Scripts executed before the backup runs

 

Accessing the script that runs before each backup
To access the Before backup script shown above:

  1. Click Jobs in the navigation bar
  2. Right-click on the desired job and select Edit.
  3. Click Scripts on the left menu.
  4. Click Run before each backup to expand the section.
Entering scripts to run before each backup

Scripts that run before a backup are useful if you need to stop certain applications from running temporarily while the backup runs, or to authenticate to remote machines that you are backing up from or to.

  1. Input scripts to be run before a backup starts directly into the script window provided. Example below:
    net stop MSSQL
    // This command will stop the Microsoft SQL service from running.
  2. You can further customize your script by inserting unique variables:
    1. Click Insert variable.
    2. Choose a variable from the list.
    3. The variable will now be inserted into your script enclosed with percentage signs (eg. %JOB_NAME%).
    4. You can insert as many additional variables as required.
    5. An example with variables:
      net send Administrator "Backup %JOB_NAME% about to start to the %JOB_NAME% backup job "
      // This command will send a network broadcast to the Administrator user with the message (example):
      "Backup SQL Data about to start to the SQL Data backup job"
  3. You can also determine how a failed script is flagged within the backup report using the drop-down menu to the right of the On script failure, report label:
    • No error
      If the script fails to execute the overall status of the backup job will not be affected.
    • Minor warning
      If the script fails to execute a minor warning will be logged and then displayed in the backup report.
    • Major warning
      If the script fails to execute a major warning will be logged and then displayed in the backup report.
    • Error
      If the script fails to execute an error will be logged and then displayed in the backup report. The job will also terminate at this point before completing any further processes. This is useful for the Before backup script if you want to stop the backup from running if the script fails.