This is a little script I wrote to be used as a subversion post-commit hook. It automatically emails an encrypted archive of the repository after every commit, so you don't have to worry too much about the subversion server exploding.
#!/bin/sh # Configuration # REPODIR=/var/svn # where your repositories live #export HOME=/home/jason # set this to your home directory if the hook # doesn't run as you, and therefore cannot find # your GPG keys... EMAIL="example+backups@gmail.com" # where to send the backups GPGID="12345678" # gpg key id to use for encrypting REPO="$1" REV="$2" echo "Running gmail-backup-svn $REPO $REV" R=`echo $REPO | sed s,$REPODIR,,` ( echo "From: $EMAIL" echo "To: $EMAIL" echo "Subject: [SVN-BACKUP] $R" echo "" if [ -n "$REV" ]; then echo "Revision: $REV"; fi for I in `seq 1 40`; do echo ""; done /usr/bin/svnadmin dump $REPO \ | /bin/gzip -c - \ | /usr/bin/gpg --armor --trust-model=always --recipient $GPGID --encrypt ) | /usr/sbin/sendmail -oi -oem -odq $EMAIL

Leave a comment