Finished main script, added backup-exclude file

master
Bryan 2020-06-24 22:06:15 -06:00
parent c8def429cd
commit 5571a18a3d
2 changed files with 24 additions and 14 deletions

6
backup-exclude Executable file
View File

@ -0,0 +1,6 @@
/proc
/run
/sys
/var/run
/var/tmp
*swap*

16
backup.sh Normal file → Executable file
View File

@ -1,17 +1,21 @@
#! /bin/bash #! /bin/bash
REPO="" REPO="ssh://bryan@172.16.1.83~/borg-backups"
PASSPHRASE="" PASSPHRASE="uD6Db2MrhxdCoKmD4gpW"
SSH_KEY="/mnt/data/home/bryan/.ssh/id_rsa"
EXCLUDE_FILE="./backup-exclude"
DIR_TO_BACKUP="/"
export BORG_REPO=$REPO export BORG_REPO=$REPO
export BORG_PASSPHRASE=$PASSPHRASE export BORG_PASSPHRASE=$PASSPHRASE
export BORG_RSH="ssh -i $SSH_KEY"
info(){ printf "\n%s %s\n\n" "$( date )" "$*" >&2; } info(){ printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
info "Starting backup" info "Starting backup"
borg create \ sudo borg create \
--verbose \ --verbose \
--filter AME \ --filter AME \
--list \ --list \
@ -19,10 +23,10 @@ borg create \
--show-rc \ --show-rc \
--compression lz4 \ --compression lz4 \
--exclude-caches \ --exclude-caches \
\ --exclude-from "${EXCLUDE_FILE}" \
####---put exclude directories here
::'{hostname}-{now}' \ ::'{hostname}-{now}' \
#####---put directories to be backed up here "${DIR_TO_BACKUP}"
backup_exit=$? backup_exit=$?