Created
September 21, 2019 19:44
-
-
Save kkroesch/16c4f6affb620b22ca953b58f993dafd to your computer and use it in GitHub Desktop.
Automated Backup with Borg
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 | |
export BORG_RSH='ssh -i ~/.ssh/id_ed25519' | |
export BORG_REPO='ssh://user@storage:22/./mail' | |
export BORG_PASSPHRASE='**********' | |
export ARCHIVE=$(date +'%a-%Y-%m-%d') | |
/usr/bin/borg create \ | |
--verbose \ | |
--filter AME \ | |
--list \ | |
--stats \ | |
--show-rc \ | |
--compression lz4 \ | |
--exclude-caches \ | |
::${ARCHIVE} \ | |
/var/vmail/mailboxes/ 2>&1 | mailx -s "Borg Backup" 'root@localhost' | |
/usr/bin/borg prune \ | |
--list \ | |
--show-rc \ | |
--keep-daily 7 \ | |
--keep-weekly 4 \ | |
--keep-monthly 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment