code et al
jordan at jordanhollinger dot com
powered by eridu

Awesome backups in like 50 lines of bash

September 29, 2012 | linux

Apple's Time Machine was a punch in the gut to all other desktop backup utilities. The time-stamped snapshots, hard-linking to save tons of space - it was just awesome. But at the same time, it was rather obvious.

It was so obvious that, like any good hacker (in the classical sense), I had to write one, too (sans the flashy GUI). I wrote it in Python and name it flux, and saw that it was good. Good at local backups, anyway. Backups to a remote server weren't.

I knew that rsync was supposed to be awesome at backups, but only theoretically. I couldn't find anything on using to it create Time Machine-style backups. So like any good hacker (in the classical sense), I got bored one Saturday and figured it out.

I call it rbackup, rather unimaginatively. There are probably 50 other programs named rbackup. And this really isn't a program; it's just 50 lines of bash script glued to rsync. Anyway, it's awesome at both local and remote backups, so here it is.

Here's how to run it

rbackup ~/ user@remotehost

That backups up your $HOME directory to "remotehost". And you can create a config file to exclude certain directories. Easy.

I'm going to set up a backup server on my home network, and automate rbackup backups of my wife's and my own Linux laptops using cron. How awesome is that? A) I have a wife, and 2) she uses Linux?!?

comments powered by Disqus