Skip to content

Instantly share code, notes, and snippets.

@sammy8806
Created January 2, 2019 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sammy8806/8fa8cc07eae9540f7bfea6943ad272c3 to your computer and use it in GitHub Desktop.
Save sammy8806/8fa8cc07eae9540f7bfea6943ad272c3 to your computer and use it in GitHub Desktop.
BorgBachup Scripts
#!/bin/bash
LOCAL_HOSTNAME=`hostname -f`
BACKUP_NAME='root'
BACKUP_PATH='/'
BACKUP_APPEND="$(date +%Y-%m-%d)$([ ! -z "$@" ] && echo "-$@")"
export BORG_RSH="ssh -p22"
export BORG_PASSPHRASE="xxxx"
borg create -v -s -p --stats \
-e re:^/var/tmp/ \
-e re:.*\.pid$ \
-e re:\.cache/ \
-e re:^/usr/src/linux.*/ \
-e re:^/var/tmp/portage/ \
-e re:./.local/share/Trash/ \
-e re:^/borg-test/ \
-e re:^/proc/ \
-e re:^/sys/ \
-e re:^/dev/ \
-e re:^/tmp/ \
-e re:^/mnt/ \
-e re:^/run/ \
-e re:^/usr/portage/ \
-e re:^/var/lib/apt/lists/ \
-e re:^/var/lib/lxcfs/ \
-e re:^/var/lib/lxd/devlxd/ \
-e re:^/var/lib/lxd/shmounts/ \
-C lz4 \
"borg@<backup-host>:~/repo::${LOCAL_HOSTNAME}-${BACKUP_NAME}-${BACKUP_APPEND}" "${BACKUP_PATH}" 2>&1
borg prune -v --list --keep-daily=8 --keep-weekly=6 --keep-monthly=6 --prefix="${LOCAL_HOSTNAME}-${BACKUP_NAME}-" "borg@<backup-host>:~/repo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment