I wanted a way to automatically backup my 1Password data to my flash drive whenever I plugged it into my MacBook Pro. I already have the data backed up through Dropbox and Backblaze but since 1Password holds all my passwords (including those to Dropbox and Backblaze), it’s important that I have as many different ways of accessing the data as possible.
Keyboard Maestro1 can trigger macros based on certain actions—on login, on system wake, by typing a key combination, etc. The two triggers available for this purpose fire either 1) when a volume mounts or 2) after attaching a USB device. The backup requires mounting a particular volume2, so I chose the first trigger.
After I plug in my thumb drive, the targeted volume mounts and a Keyboard Maestro macro triggers the Zsh script (below). This script uses an
rsync alias I’ve taken from Prezto (a Zsh configuration) called
rsync-synchronize to update the data on the thumb drive.
This Keyboard Maestro macro with Zsh script automates the synchronization of my 1Password data to my thumb drive every time I plug it in, rendering yet another backup of it’s valuable data.
Finally, if this is all too hacky for you, checkout Carbon Copy Cloner’s folder-to-folder backup’s for a nice GUI to the backup process.