From 5571a18a3dba3de497e033316cb5fb468e4b1ae2 Mon Sep 17 00:00:00 2001 From: Bryan Date: Wed, 24 Jun 2020 22:06:15 -0600 Subject: [PATCH] Finished main script, added backup-exclude file --- backup-exclude | 6 ++++++ backup.sh | 32 ++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100755 backup-exclude mode change 100644 => 100755 backup.sh diff --git a/backup-exclude b/backup-exclude new file mode 100755 index 0000000..797679a --- /dev/null +++ b/backup-exclude @@ -0,0 +1,6 @@ +/proc +/run +/sys +/var/run +/var/tmp +*swap* diff --git a/backup.sh b/backup.sh old mode 100644 new mode 100755 index b512539..6afd866 --- a/backup.sh +++ b/backup.sh @@ -1,28 +1,32 @@ #! /bin/bash -REPO="" -PASSPHRASE="" +REPO="ssh://bryan@172.16.1.83~/borg-backups" +PASSPHRASE="uD6Db2MrhxdCoKmD4gpW" +SSH_KEY="/mnt/data/home/bryan/.ssh/id_rsa" +EXCLUDE_FILE="./backup-exclude" +DIR_TO_BACKUP="/" export BORG_REPO=$REPO export BORG_PASSPHRASE=$PASSPHRASE +export BORG_RSH="ssh -i $SSH_KEY" info(){ printf "\n%s %s\n\n" "$( date )" "$*" >&2; } trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM info "Starting backup" -borg create \ - --verbose \ - --filter AME \ - --list \ - --stats \ - --show-rc \ - --compression lz4 \ - --exclude-caches \ - \ - ####---put exclude directories here - ::'{hostname}-{now}'\ - #####---put directories to be backed up here +sudo borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --compression lz4 \ + --exclude-caches \ + --exclude-from "${EXCLUDE_FILE}" \ + + ::'{hostname}-{now}' \ + "${DIR_TO_BACKUP}" backup_exit=$?