Now that I've given up on .Mac sync, I see it's very simple to push the data out. The biggest problem is that rsync doesn't approve of Apple's spaces in names, so I have to get a bit silly with double quoting. Not a big deal.

This raises a big question, though: How does .Mac sync notify apps that their data has just been changed out from under them, and they should reload? Obviously all these apps have some mechanism to reread their data, because Apple uses it, but I have no idea what it is. For Address Book & iCal, it would be reasonable to close them as part of the script (if I could find a way that didn't involve sending a Quit AppleEvent, which has an annoying tendency to launch non-running apps solely so it can tell them to Quit). But for Safari, it would be quite bad to lose all the tabs I left open.

Does anyone know how .Mac does its update magic?

Here's the simple script -- insert your own names for mac1, mac2, etc.:

#!/bin/sh
# rsync-dotmac.sh
# Push or pull current .Mac content (Address Book, iCal, and Safar bookmarks) from master to read-only systems.
# Really needs a way to tell applications on read-only systems not to allow (futile) changes.

for h in mac1 mac2
 do
  rsync -n -va --delete ~/Library/Application\ Support/AddressBook/ $h:"Library/Application\ Support/AddressBook/"
  rsync -n -va --delete ~/Library/Application\ Support/iCal/ $h:"Library/Application\ Support/iCal/"
  rsync -n -va --delete ~/Library/Safari/Bookmarks.plist $h:Library/Safari/Bookmarks.plist
 done

Note that this script doesn't actually update anything. Once you have your real hostnames entered, remove -n from the script, and perhaps the v option as well, since you won't be seeing the output once it's in your crontab.


Hmm, I wonder if Library/Application\ Support/AddressBook/.database.lockN is relevant...