Created
January 2, 2019 03:51
-
-
Save sammy8806/8fa8cc07eae9540f7bfea6943ad272c3 to your computer and use it in GitHub Desktop.
BorgBachup Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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