After some weeks of using TeamDrive I felt that I have to get another solution for syncing. TeamDrive isn’t bad, but it isn’t good either. It works most of the time, say 95%. But syncing is a matter of 100% trust, so I can’t live with crashes or “oh, I’ll sync in a few minutes, perhaps”.
So I decided to give unison and OS X “Folder Action” a try. But those don’t have a “on file change” event and reading about it many user complain that they aren’t really reliable. So that wouldn’t be better that TeamDrive.
Than launchd came in my head. I remembered the magic with the ssh-keys and thought: Hey, use a launchd FSEvent and combine it with unison – that’s it! Read some doc and finally: All you need is a little plist like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>de.dlite.unison</string>
<key>OnDemand</key>
<true/>
<key>Program</key>
<string>/Users/joedoe/bin/unison.sh</string>
<key>WatchPaths</key>
<array>
<string>/Users/joedoe/Library/Things</string>
</array>
</dict>
</plist>
Than add it to launchd via
launchctl load ~/Library/LaunchAgents/de.dlite.unison.plist
and here we go: Saving a file, creating a new one or deleting an old one always delivers a fine call of my unison-script which syncs with my own server. 🙂