You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.1 KiB
Bash
62 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
#####################
|
|
# FUNCTION SWITCHES #
|
|
#####################
|
|
|
|
# For any function that you want to run, change from "no" to "yes"
|
|
readonly DEBUG='no'
|
|
readonly NTFY_NOTIFICATIONS='no'
|
|
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
|
|
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"
|
|
readonly DATETIME="$(date '+%Y-%m-%d_%H:%M:%S')"
|
|
readonly BACKUP_LOG="${LOG_DIR}/backupLog_"${DATETIME}".log"
|
|
readonly LOG_RETENTION="14"
|
|
|
|
################
|
|
# RSYNC SCRIPT #
|
|
################
|
|
|
|
## Configure variables from here...
|
|
# readonly RSYNC_SOURCE="/path/to/dir/to/backup"
|
|
# readonly RSYNC_DEST="/path/to/dir/to/backup/to"
|
|
# 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"
|
|
|
|
#################
|
|
# 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"
|
|
# readonly RESTIC_TAG_01="${HOSTNAME}"
|
|
# readonly RESTIC_TAG_02="TAG-02"
|
|
# readonly RESTIC_EXCLUDES="${SCRIPT_DIR}/resticExcludes" |