Skip to content

Instantly share code, notes, and snippets.

@Crhistoph
Created July 11, 2012 15:59
Show Gist options
  • Save Crhistoph/3091349 to your computer and use it in GitHub Desktop.
Save Crhistoph/3091349 to your computer and use it in GitHub Desktop.
Duplicity backup of Maildir
#!/bin/sh
export PASSPHRASE=mgpgpassphrase
export AWS_ACCESS_KEY_ID=mys3accesskey
export AWS_SECRET_ACCESS_KEY=mys3secretaccesskey
date="date +%d"
GPG_KEY="mygpgkey" #Public GPG Key
SOURCE="~/Mail"
DEST="S3+http://bucketname/backup/"
#Backup, sets full rather than incremetal if first of month.
if [ "$date" = 01 ]
then
FULL="full"
else
FULL=""
fi
duplicity ${FULL} --encrypt-key=${GPG_KEY} --sign-key=${GPG_KEY} --s3-european-buckets --s3-use-new-style ${SOURCE} ${DEST}>>/var/log/duplicity/mail.log
#Delete old backups
duplicity remove-older-than 1M --force ${DEST}>>/var/log/duplicity/mail.log
#Reset env variables
export PASSPHRASE=
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment