Hooking Backup through an external script

 

Under Development

While this interface should be generally stable there may be additional changes pre-beta

Files

By default we look for hooks in the /home/asterisk/Backup folder. If you want to put scripts in a different location you may set an environment variable.

BACKUPHOOKDIR=/path/to/your/directory fwconsole bu --backup [ID]

or

export BACKUPHOOKDIR=/path/to/your/directory

The script can be in any language as long as it is executable and has the appropriate header below.

By Header

In your chosen language add one of the following as a comment. The files in the hook directory will be scanned

  • pre:restore

  • post:restore

  • pre:backup

  • post:backup

By Environment Variables

  • BACKUPPREHOOKS - Run before backup.

  • BACKUPPOSTHOOKS - Run after backup.

  • RESTOREPREHOOKS - Run before restore.

  • RESTOREPOSTHOOKS - Run after restore.

Each of these items will accept a single item or a comma separated list. The items must be the full path.

BACKUPPREHOOKS=/opt/foo.sh

BACKUPPOSTHOOKS=/opt/bar.sh,/opt/baz.sh,/usr/bin/alert.py

Arguments

Pre-Backup

  1. backupid

  2. transactionid

 

Post-Backup

  1. backupid

  2. transactionid

  3. base64 encoded json string with signatures

  4. base64 encoded json string with errors

Pre-Restore

  1. transactionid

  2. base64 encoded json string with backup data

Post-Restore

  1. transactionid

  2. base64 encoded json string with backup data

 

Return to Documentation Home I Return to Sangoma Support