peteg's blog - hacking - 2006 08 06 Backups

Backups at CSE.

/hacking | Link

I was very proud of myself when I cooked up the following to backup and encrypt my email to CSE's shiny new selfbackup server in a streaming manner. Assuming you've set up GPG and your environment sets $EMAIL and $USER appropriately, this will encrypt a tar archive of ~/Library/Mail using your public key:

tar c ~/Library/Mail/ |
   gpg -e -r $EMAIL |
   ssh selfstore.cse.unsw.edu.au "cat - > /backups/$USER/.mail.gpg &&
      mv /backups/$USER/.mail.gpg /backups/$USER/mail.gpg"

Decryption is just a matter of gpg -d | tar x.