HTML HELP

Advanced Scripting in BackupAssist™


Contents:  

  1. How to write advanced scripts in BackupAssist™ with environment variables
  2. An example Advanced Script with environment variables
  3. Example Advanced Script for sending the backup to an FTP Server


How to write advanced scripts in BackupAssist™ with environment variables

BackupAssist™ offers a number of environment variables that you can easily incorporate into pre and post backup scripts.

The following is a list of the variables currently available to BackupAssist™

Using these variables allows you to greatly customize your backup scripts, particularly when using the BackupAssist™_STATUS as you can specify different actions to occur depending on whether the backup fails or succeeds.

To input scripts into BackupAssist™, please carry out the following:

1. Select the 'Advanced Tab' in BackupAssist™

2. Select 'Modify scripts to run before and after the backup'

3. Manually enter scripts you wish to run before or after the backup process


Figure 1: Modifying Scripts in BackupAssist™

An example Advanced Script with environment variables

The following sample script demonstrates how to execute different commands depending on whether a backup succeeded or failed.

@echo off

if %BACKUPASSIST_STATUS% == 0 goto ERROR_COMMANDS

:SUCCESS_COMMANDS
@REM ---> Backup succeeded. Insert commands here

net send admin-desktop "Backup Completed Successfully"

goto END

:ERROR_COMMANDS
@REM ---> Backup failed. Insert commands here

net send admin-desktop "Backup Failed"

:END
@REM ---> Insert any final commands here that are executed for both successful and failed backups.

net send admin-desktop "Backup Operation has finished"

Example Advanced Script for sending the backup to an FTP Server

The following sample script demonstrates how to use the free command-line utility NCFTP and the ncftpput command to upload your backup file to a FTP server, only if the backup is successful.

@echo off

if %BACKUPASSIST_STATUS% == 0 goto END

:SUCCESS_COMMANDS
@REM ---> Backup succeeded so send the backup file to the FTP server

"C:\Program Files\NCFTP\ncftpput" -u username -p password domainname.com /backups "%BACKUPASSIST_FILENAME%"

:END
@REM ---> Insert any final commands here that are executed for both successful and failed backups.

net send admin-destkop "Backup Operation has finished - check the report for the status"