Automated backup to Strongspace with rsync, Automator, and Highrise

Not long ago, I switched to TextDrive after being let down by a cheaper web host. So far, it’s been great…it’s a lot more feature rich and the people over there really know what they’re doing.

The basic $8/month plan includes access to 5GB of file storage for backup/sharing/whatever. I use it to back up regular ol’ documents and files on a daily basis.

They make this easy to do with a UNIX tool called rsync that compresses and transfers only the files that have changed. rsync is the real workhorse here, but I’ve rigged up a backup solution that utilizes all of the following tools:

  • rsync – does the actual file transfer
  • ssh keys – used to avoid entering manual passwords, which enables scripting
  • Automator – ties together the scripts into an application
  • iCal – enables scheduling of the application
  • Growl – provides notification onscreen that the script ran
  • Highrise – keeps a running history of the activity and provides RSS access

To cut to the case, download this file and check out the scripts. For more detail, read on.

This idea uses the UNIX philosophy of employing many small tools each perfectly suited for their job. (I love it.) Let’s take it step by step.

  1. rsync – It’s easy to familiarize yourself with this portion, since you can run it “interactively” on the command line. I do something very similar to what this gentleman did, though I supply slightly different options to rsync as per the recommendations of the Strongspace folks.
  2. ssh keys – If you play with rsync for a while, you’ll see that it asks for a password when you run it. Since we want to script this, we can’t have that, now can we? Fortunately it’s easy to generate ssh keys, which basically make your computer and your Strongspace account “trust each other” so that checking ID isn’t necessary.
  3. Automator – This part is pretty easy…I use Automator in OS X to string together the basic sequence of steps: backup the files, send the log to Highrise, and flash a Growl notification. Download this file to check it out.
  4. iCal – I chose to use iCal to schedule the Automator action (using this basic method) rather than a daemon like cron because it seemed like a more natural, Mac-like fit.
  5. Growl – I’ll be honest, this step is mostly for fun…Growl is just good times. However, I do use it as a quick validation that iCal lauched the script.
  6. Highrise – Growl is cool, but it didn’t provide much in the way of detail as to what happened with the script. I kinda wanted to see a log of what happened, except I didn’t feel like managing log files. I was really looking to get the log info via RSS, and for that I had to post it to the web somewhere. Highrise solves all these issues, and the default Dashboard view is great in the way it highlights the latest info. (After all, I really don’t care about yesterday’s backup after today.) My script e-mails the contents of the log file to my Highrise Dropbox, which was really easy to do with just a few lines of Ruby code.

So far, this has worked without a hitch, and I feel much better having my files backed up everyday.