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=$?