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*

18
backup.sh Normal file → Executable file
View File

@ -1,17 +1,21 @@
#! /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 \
sudo borg create \
--verbose \
--filter AME \
--list \
@ -19,10 +23,10 @@ borg create \
--show-rc \
--compression lz4 \
--exclude-caches \
\
####---put exclude directories here
::'{hostname}-{now}'\
#####---put directories to be backed up here
--exclude-from "${EXCLUDE_FILE}" \
::'{hostname}-{now}' \
"${DIR_TO_BACKUP}"
backup_exit=$?