#!/usr/bin/env bash #///////////////////////////////////////////////////// # # # BORG BACKUP # # #///////////////////////////////////////////////////// # NOTE: Make sure the repository is initialize with borg init # first before creating a backup! # NOTE: Make sure the expect command is installed on the system! # NOTE: All these variables can be placed in /etc/borgbackup.conf # Path to repository # Example: user@server:/path/on/remote # NOTE: Make sure it ends with / or face the consquences! REPOSITORY='' # Passphrase for borg backup. # NOTE: If you don't want to include the passphrase here. # You can include it in /etc/borgbackup.conf PASSPHRASE='' # Source directory to backup # Example: /path/to/backup SOURCE='/' # Exclude paths from backup. # Example: --exclude /exclude1 --exclude /exclude2 EXCLUDES='' # Run commands before backup # Example: systemctl stop mysqld PREHOOK="" # Run commands after backup # Example: systemctl start mysqld POSTHOOK="" # DO NOT MODIFY ANY CODE BELOW THIS LINE if test -f /etc/borgbackup.conf; then source /etc/borgbackup.conf fi echo "Running PREHOOK..." eval $PREHOOK echo "Running borg backup.." expect <