66 lines
1.8 KiB
Bash
Executable file
66 lines
1.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Configuration options for the backup.sh script v4
|
|
# TODO Do the v4
|
|
|
|
cd `dirname ${BASH_SOURCE-$0}`
|
|
|
|
# Connection options
|
|
|
|
# Type of connection to the backup server
|
|
TYPE="sftp"
|
|
# Hostname/IP of the backup server
|
|
HOST="bkpuser@backup.example.com"
|
|
# Location of the backup directory on the backup server
|
|
DEST="/srv/bkp/host"
|
|
BDEST="/srv/bkp/host"
|
|
|
|
# You will need to create a `resticpass` file in this directory
|
|
|
|
# Exported variable for extra restic manipulation if needed
|
|
export RESTIC_REPOSITORY="$TYPE:$HOST:$DEST"
|
|
export BORG_REPO="ssh://$HOST$BDEST"
|
|
export RESTIC_PASSWORD_FILE="$PWD/resticpass"
|
|
export BORG_PASSPHRASE="$(cat $PWD/borgpass)"
|
|
|
|
# Export options
|
|
|
|
# Where the various exports will be saved
|
|
# The file will be deleted afterwards, so it is only to locate it in the backup
|
|
WORKING_DIR="/var/bkp"
|
|
|
|
# Create a etckeeper commit (make sure /etc is in $FILES for it to be saved) (unset if uneeded)
|
|
ETCKEEPER_COMMIT_MESSAGE="Sauvegarde automatique du $(date)"
|
|
|
|
|
|
# Backup options
|
|
|
|
# Directories to backup
|
|
FILES="/"
|
|
# Pattern to exclude
|
|
EXCLUDE=$(echo --exclude={"/var/cache","**.lock","**/.cache/"})
|
|
# Tags to add to the backups
|
|
TAGS=$(echo --tag={"auto","v3"})
|
|
# Options for the backup command
|
|
export BACKUP_OPTIONS="--one-file-system --cleanup-cache $FILES $EXCLUDE $TAGS"
|
|
export CREATE_OPTIONS="--one-file-system --compression auto,zstd $EXCLUDE"
|
|
|
|
# Forget options
|
|
|
|
# Which snapshots to keep (inclusive)
|
|
KEEP="--keep-hourly 24 --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 10"
|
|
# Options for the restic forget command (unset if uneeded)
|
|
export FORGET_OPTIONS="$KEEP --prune"
|
|
export PRUNE_OPTIONS="$KEEP"
|
|
|
|
# Executable options
|
|
|
|
# Location of the restic command (you might want to add sudo in there)
|
|
# RESTIC_CMD="$(which restic)"
|
|
RESTIC_OPTIONS="--cache-dir /var/cache/restic"
|
|
|
|
BORG_CMD="$(which borg)"
|
|
BORG_OPTIONS=""
|