View Single Post
Installation
I have taken these instructions: Ken Case, Senor Pantalones, and heavily modified them.

Requirements
You must have a central (either local or on the internet), 99% uptime repository with a static IP.

Growl
I you want to this to be awesome, install Growl and the growlnotify tool, because growl notifications are included in the script, alerting when it syncs. The script detects if growlnotify is installed and uses it if it's available. Note that growlnotify doesn't currently work reliably in Leopard, so if you're using 10.5 don't expect to get all notifications.

Terms
"Client" refers to the client computers running OmniFocus.

Each of your client computers has a "computer name." You can find this by typing "hostname -s" in terminal. Ken's examples were jamethiel and hypno.

"Host" refers to the central computer (which could be running OmniFocus) which contains the Mirrors folder and hosts sync files/backups for OmniFocus and Mirrored folders.

myhost.com refers to your static IP of your host. In SP's case, it's code404.com. In ken's case (ken case! ha!), it's example.org. If it's a local machine with a manually-entered IP addres, it will be something like "10.0.1.101" If your host is a mac, enable remote access in the sharing preferences.

myname refers to your login name/account name on myhost.com

Setting up the DSA keys:
Since you don't want to be entering passwords everywhere, you should generate DSA keys so your computers can freely communicate.

Host:
1. On any client computer, open terminal. Type the following: ssh myname@myhost.com Enter your password. This window will be where you enter host commands.

2. Type "ssh-keygen -tdsa", and accept all defaults.

Leave this host window open.

Client:
3. On a client computer, open Terminal (or open a new window if you did step 1 on this machine). You're now most likely in your home directory. Type "ssh-keygen -tdsa", and accept all defaults.

4. In the client window, type the following:
scp ~/.ssh/id_dsa.pub myname@myhost.com:id_dsa.pub You have just copied your key to the host

5. In host terminal window (myhost.com), type the following commands:
cat id_dsa.pub >> ~/.ssh/authorized_keys2
rm id_dsa.pub


6. Repeat steps 3-5 for each client computer.

7. In host terminal window (myhost.com), type the following commands:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys2


This will now allow you to ssh, scp and rsync from your client to host without having to enter your password.

If you're not much of a terminal junkie, you're likely using bash, the default shell. If you're using tcsh or zsh, you already know enough about what you're doing to modify the following instructions to meet your needs.

Installing Scripts
1. Grab the file "SyncMirror folder.zip" included in this post.

2. Put it in your home directory.

3. Double click it to unzip it, then delete the zip file.

4. Open bash_profile in a text editor like BBEdit or TextEdit.

Change the content in red to your own information.

omsync_username="yourname"
omsync_hostname="yourdomain.com"

5. Save, and close the file.

6. The "SyncMirror Folder" is now customized for your clients. Copy it to the other client computers you plan on using.

7. Move all of the files out of the "SyncMirror Folder" folder to your home folder. You can put the SyncMirror application anywhere.

8. Open terminal, and type the following command:
mv bash_profile .bash_profile

Repeat steps 7 and 8 for each client.

Pushing the files up there:
1. Open the SyncMirror applicaiton on the client machine with the files you want to push to the server. It will ask if you want to add your machine's name to the list, click yes.

2. Click Push, and wait for the Push to comlete. A Mirrored folder will be created on your client machine, which you can now put files in to be synced. A Mirrors folder will be created on your host, it will contain a folder for this client machine.

Verify that your files have been pushed to your server. If SyncMirror didn't work, you can try push_files from the terminal, and see any error messages.

Setting up the LaunchAgent:
This is optional, but recommended.

Although unix folks are more accustomed to cron, it's been phased out (but still supported) in OS X, in favor of LaunchAgents (for tasks run while the user is logged in) and LaunchDaemons (for tasks run regardless of user login). We're going to set up a LaunchAgent that runs every 30 minutes.

1. The files filesync.sh and com.omnigroup.OmniFocusSync.plist should be in your home directory, added in "Installing Scripts" above.

2. Open com.omnigroup.OmniFocusSync.plist in a text editor like BBEdit or TextEdit.

Change the content in red to your own information.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.omnigroup.OmniFocusSync</string>
<key>ProgramArguments</key>
<array>
<string>/Users/Enter-your-home-directory-here/filesync.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>1800</integer>
</dict>
</plist>


3. Save, and close the file.

4. Move the file to LaunchAgents, set permissions, and load it up. In Terminal, type:

mkdir -p ~/Library/LaunchAgents

mv com.omnigroup.OmniFocusSync.plist ~/Library/LaunchAgents/

sudo chown root:wheel ~/Library/LaunchAgents/com.omnigroup.OmniFocusSync.plist

sudo launchctl load ~/Library/LaunchAgents/com.omnigroup.OmniFocusSync.plist


As long as you didn't get an error, you've successfully set up auto-syncing on your client computer. It will now sync omnifocus data every 30 minutes.

Repeat all of these steps to setup launchagent for each client.

The cQuitAppList in SyncMirror
SyncMirror can check if certain applications are running before a sync. The cQuitAppList initially just has Omnifocus, but you can add others, as in this example:

--Fill in the following list with the applications that you want to be warned to quit before syncing
set cQuitAppList to {"OmniFocus", "Quicken", "SBook5"}

To edit the list, open SyncMirror in Script Editor, edit the list, and save.

If anyone has any problems, please let me know.
Attached Files
File Type: zip SyncMirror folder.zip (51.2 KB, 637 views)