Backup Pre and Post Scripts
You might require the use of pre and post scripts for your backups. With this, you can perform use cases like closing a file-based database before a backup and reopening it after the backup.
Limitations:
Business or Agency Plan's only
Own Servers (not supported on SnapShooter AWS compute, or serverless)
Setup
On your server you can make a script for pre and post backups, you can do none, one or both.
The scripts will need to be executable, if they are not they will be skipped:
chmod +x script
Your scripts will need to start with a "Shebang Interpreter Directive" Examples:
#!/bin/bash - Uses bash to parse the file.
#!/usr/bin/env perl - Uses the env command to find the path to the perl executable.
#!/usr/bin/python Executes the file using the python binary.
Exit Codes
If the prescript exits with a non 0 exit code, the backup will skip all the steps and register the backup as failed. If the prescript fails and there is a postscript present we will attempt to run the postscript before finishing.
If the postscript fails the backup will be registered as success with error.
Notes
If your script takes more than ~5 minutes to run the system will timeout the backup and your script might stop mid execution.
The script can access the following ENV from SnapShooter
$WORKING_DIR which will be the current folder SnapShooter is using for backups and can be a good place to store any temp files
$SNAPSHOOTER_BACKUP_ID the backup ID
If you make any Temporary files in the working directory SnapShooter will not attempt to clean them up after the backup. However, note we do clean up all working directors that are over 2 days old. We do this to make sure we don't fill up serves with logs. Any files in these folders will be erased.
Thank you for helping us improve!