Hooking Backup through an external script
- 1 Files
- 2 By Header
- 3 By Environment Variables
- 4 Arguments
- 4.1 Pre-Backup
- 4.2 Post-Backup
- 4.3 Pre-Restore
- 4.4 Post-Restore
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
backupid
transactionid
Post-Backup
backupid
transactionid
base64 encoded json string with signatures
base64 encoded json string with errors
Pre-Restore
transactionid
base64 encoded json string with backup data
Post-Restore
transactionid
base64 encoded json string with backup data