|
|
|
@ -4,39 +4,63 @@
|
|
|
|
|
# FUNCTION SWITCHES #
|
|
|
|
|
#####################
|
|
|
|
|
|
|
|
|
|
# For any function that you want to run, change from "no" to "yes"
|
|
|
|
|
## For any function that you want to run, change from "no" to "yes"
|
|
|
|
|
|
|
|
|
|
## For debugging the script
|
|
|
|
|
readonly DEBUG='no'
|
|
|
|
|
|
|
|
|
|
## For use with NTFY.
|
|
|
|
|
## If set 'yes' will need to set NTFY_URL further below
|
|
|
|
|
readonly NTFY_NOTIFICATIONS='no'
|
|
|
|
|
|
|
|
|
|
## For running the rsync script.
|
|
|
|
|
## Will ened to set the rsync vars further below
|
|
|
|
|
readonly RSYNC_BACKUP='no'
|
|
|
|
|
readonly LOCAL_RESTIC_BACKUP='no'
|
|
|
|
|
readonly LOCAL_RESTIC_BACKUP_CLEAN='no'
|
|
|
|
|
readonly REMOTE_RESTIC_BACKUP_CLEAN_LOCAL='no'
|
|
|
|
|
readonly REMOTE_RESTIC_BACKUP='no'
|
|
|
|
|
readonly REMOTE_RESTIC_BACKUP_CLEAN='no'
|
|
|
|
|
# Set the below 'no' if using keep last instead
|
|
|
|
|
|
|
|
|
|
## For running the restic script.
|
|
|
|
|
readonly LAN_RESTIC_BACKUP='no'
|
|
|
|
|
readonly LAN_RESTIC_CLEAN='no'
|
|
|
|
|
readonly AWS_RESTIC_BACKUP='no'
|
|
|
|
|
readonly AWS_RESTIC_CLEAN='no'
|
|
|
|
|
|
|
|
|
|
## Set to 'yes' if running a LAN_RESTIC_CLEAN prior to an AWS_RESTIC_BACKUP of the LAN repo
|
|
|
|
|
## If set to 'yes' set the restic vars further below for the LAN repo
|
|
|
|
|
## And set the AWS restic repo vars in the variables-aws.sh file
|
|
|
|
|
## restic retention vars set in this file will be for LAN, variables-aws.sh will have the AWS retention
|
|
|
|
|
## Also leave the RESTIC_TAGs and RESTIC_EXCLUDES vars commented out in this file
|
|
|
|
|
readonly LAN_AND_AWS_RESTIC='no'
|
|
|
|
|
|
|
|
|
|
## Set to 'no' if using RESTIC_RETENTION_KEEP_LAST further below
|
|
|
|
|
readonly RESTIC_CALENDAR_RETENTION='yes'
|
|
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
# LOGGING & ERROR HANDLING #
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
|
|
# Ensure you set the SCRIPT_DIR variable correctly as the error handling will not catch it
|
|
|
|
|
# Change the LOG_RETENTION if you wish for more or less.
|
|
|
|
|
readonly LOG_DIR="${SCRIPT_DIR}/backupLogs"
|
|
|
|
|
## Leave these vars be
|
|
|
|
|
readonly LOG_DIR="${SCRIPT_DIR}/logs"
|
|
|
|
|
readonly DATETIME="$(date '+%Y-%m-%d_%H:%M:%S')"
|
|
|
|
|
readonly BACKUP_LOG="${LOG_DIR}/backupLog_"${DATETIME}".log"
|
|
|
|
|
readonly LOG_RETENTION="14"
|
|
|
|
|
readonly BACKUP_LOG="${LOG_DIR}/"${DATETIME}"_backup.log"
|
|
|
|
|
|
|
|
|
|
## Adjust to your preferred retention
|
|
|
|
|
readonly LOG_RETENTION='30'
|
|
|
|
|
|
|
|
|
|
## If using, must set NTFY_NOTIFICATIONS further above to 'yes'
|
|
|
|
|
# readonly NTFY_URL='user:password@ntfy.tld/topic'
|
|
|
|
|
|
|
|
|
|
################
|
|
|
|
|
# RSYNC SCRIPT #
|
|
|
|
|
################
|
|
|
|
|
|
|
|
|
|
## Configure variables from here...
|
|
|
|
|
# readonly RSYNC_SOURCE="/path/to/dir/to/backup"
|
|
|
|
|
# readonly RSYNC_DEST="/path/to/dir/to/backup/to"
|
|
|
|
|
## Only uncomment and set these if RSYNC_BACKUP further above is set to 'yes'
|
|
|
|
|
|
|
|
|
|
## Set these vars
|
|
|
|
|
# readonly RSYNC_SOURCE='/path/to/dir/to/backup'
|
|
|
|
|
# readonly RSYNC_DEST='/path/to/dir/to/backup/to'
|
|
|
|
|
# readonly RSYNC_RETENTION_DAYS='7'
|
|
|
|
|
|
|
|
|
|
## Leave these vars be
|
|
|
|
|
# readonly RSYNC_MANIFEST="${SCRIPT_DIR}/rsyncManifest"
|
|
|
|
|
# readonly RSYNC_RETENTION_DAYS="7"
|
|
|
|
|
## ...to here
|
|
|
|
|
# readonly RSYNC_DEST_PATH="${RSYNC_DEST}/${DATETIME}"
|
|
|
|
|
# readonly RSYNC_LATEST_LINK="${RSYNC_DEST}/latest"
|
|
|
|
|
|
|
|
|
@ -44,19 +68,29 @@ readonly LOG_RETENTION="14"
|
|
|
|
|
# RESTIC SCRIPT #
|
|
|
|
|
#################
|
|
|
|
|
|
|
|
|
|
## Only use the following two AWS vars if backing up to a compatible repo
|
|
|
|
|
# export AWS_ACCESS_KEY_ID="KEY-IID"
|
|
|
|
|
# export AWS_SECRET_ACCESS_KEY="SECRET-KEY"
|
|
|
|
|
## Set all the remaining variables except for the last
|
|
|
|
|
# export RESTIC_PASSWORD="REPOSITORY-PASSWORD"
|
|
|
|
|
# export RESTIC_REPOSITORY="PATH-TO-REPOSITORY"
|
|
|
|
|
# readonly RESTIC_SOURCE="/path/to/dir/to/backup"
|
|
|
|
|
# readonly RESTIC_RETENTION_DAYS="7"
|
|
|
|
|
# readonly RESTIC_RETENTION_WEEKS="4"
|
|
|
|
|
# readonly RESTIC_RETENTION_MONTHS="6"
|
|
|
|
|
# readonly RESTIC_RETENTION_YEARS="1"
|
|
|
|
|
## If you prefer a keep last retention policy, comment out the above 4 and uncomment the below and configure
|
|
|
|
|
# readonly RESTIC_RETENTION_KEEP_LAST="2"
|
|
|
|
|
## Only uncomment and set these if the relevant RESTIC vars further above are set to 'yes'
|
|
|
|
|
|
|
|
|
|
## Only set these if backing up to a compatible repo
|
|
|
|
|
# export AWS_ACCESS_KEY_ID='KEY-ID'
|
|
|
|
|
# export AWS_SECRET_ACCESS_KEY='SECRET-KEY'
|
|
|
|
|
|
|
|
|
|
## Set these for all restic configurations
|
|
|
|
|
# export RESTIC_REPOSITORY='/path/to/repo'
|
|
|
|
|
# export RESTIC_PASSWORD='PASSWORD'
|
|
|
|
|
# readonly RESTIC_SOURCE='/path/to/dir/to/backup'
|
|
|
|
|
|
|
|
|
|
## RESTIC_CALENDAR_RETENTION must be set to 'yes' for these
|
|
|
|
|
# readonly RESTIC_RETENTION_DAYS='3'
|
|
|
|
|
# readonly RESTIC_RETENTION_WEEKS='1'
|
|
|
|
|
# readonly RESTIC_RETENTION_MONTHS='1'
|
|
|
|
|
# readonly RESTIC_RETENTION_YEARS='1'
|
|
|
|
|
|
|
|
|
|
## RESTIC_CALENDAR_RETENTION must be set to 'no' for this
|
|
|
|
|
# readonly RESTIC_RETENTION_KEEP_LAST='2'
|
|
|
|
|
|
|
|
|
|
## Recommendation is to leave the first tag be, and configure the second
|
|
|
|
|
# readonly RESTIC_TAG_01="${HOSTNAME}"
|
|
|
|
|
# readonly RESTIC_TAG_02="TAG-02"
|
|
|
|
|
# readonly RESTIC_TAG_02='TAG-02'
|
|
|
|
|
|
|
|
|
|
## Leave this var be
|
|
|
|
|
# readonly RESTIC_EXCLUDES="${SCRIPT_DIR}/resticExcludes"
|