Skip to content

Instantly share code, notes, and snippets.

@kkroesch
Created September 21, 2019 19:44
Show Gist options
  • Save kkroesch/16c4f6affb620b22ca953b58f993dafd to your computer and use it in GitHub Desktop.
Save kkroesch/16c4f6affb620b22ca953b58f993dafd to your computer and use it in GitHub Desktop.
Automated Backup with Borg
#!/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