View Single Post
Overview
This is a user interface and scripts to sync your OmniFocus document folder and a 'Mirrored' folder between two or more machines and a central server. I use it to 'transfer control' of my Omnifocus and other documents between a laptop and desktop.

SyncMirror is based on a post by Ken Case, and then detailed instructions by Señor Pantalones. From their work, I rewrote it, added a user interface, and lots of new features to make it more user friendly.

How it works
Omnifocus 1.0 can't merge changes made by multiple users into a single document, so in our case sync really means tracking which is the most-current document, or put another way, who owns it, and then copying it to another machine. To transfer ownership of the sync, the files (or at least the recent changes to the files) are copied to the server, and then copied from the server to the new owner.

MirrorSync uses a central server to store the synced documents from each client, with one folder for each client in a 'Mirrors' folder. Note that the central server could also be a client, but I haven’t tested this. We use the term 'Push' when we copy from a client to the server, and 'Pull' when client files are replaced with files from another client that are on the server.

The script keeps track of who 'owns' the sync. The name of the owner is stored on the server.

Another reason the word 'sync' is used here is that we use rsync to push or pull the files. rsync is efficient, only copying changes, not entire files or unchanged files.

Using SyncMirror
After installation and setup, open the SyncMirror application. If you're using a remote server, it may take a few seconds for SyncMirror to contact the server to find out who owns the sync. If you own the sync, you'll see:



The title bar shows that you own the sync. If you want to transfer it to, say, your desktop, then click Push. SyncMirror will first check to see if any applications are running that you have specified (i.e. OmniFocus), and warn you, so that there aren't any unsaved changes. The list of applications is cQuitAppList in SyncMirror. It then copies your changes since the last push to the server.

Now, go to your desktop machine and open SyncMirror on that machine. You will see:



Just hit return, and SyncMirror will compare the local files to the files on the server for the sync owner (in this case MacBook-Pro-David), and update the local files to match. If you run SyncMirror again, it will show that your desktop machine now owns the sync.

To help you remember if you do or don't own the sync, SyncMirror will change the color of your 'Mirrored' folder and its immediate descendants to green if you own it, red if you don't.


Timed Push
As with the original post by Ken, you can optionally set up timed pushes so that the server always has a recent copy of your Mirrored and OmniFocus folders. This is useful if you forget to do a push, and want to later pull on another machine. The only downside is if you have open documents, you may loose unsaved changes. Timed pushes also make manual pushes faster.

Terminal commands
If you prefer using the terminal, you can use push_files and pull_files.

push_files
This pushes the current version of your Omnifocus and Mirrored folders from your client computer (the one on which you're typing) to the host. Use this right before you're about to switch from one computer to another, go home from work, etc.

pull_files computername
This gets the latest version of your Omnifocus and Mirrored folders from your host computer and puts it on your client computer. Use this when you get on another computer, when you get home from work, etc.

get_who_last_pulled
This gets the computer name of the client that last pushed to the server. You can pipe this to pull_files. It also colors the Mirrored folder.