On Mon, 2006-07-31 at 10:53 -0500, Justin Dugger wrote:
Or if you want something a bit more attached to your user's session rather than the system, you could investigate dbus/hal. This is how GNOME automatically mounts USB drives and CD drives as your user, among other things. In fact, one of the options I see under "Removable Media and Storage" is which command to run when a Portable Music Player is connected. It seems to be oriented to playing music locally, but I see no reason why you can't change the command to do your sync instead of starting rhythmbox.
That might be a nice option as long as it works. You'll want to create a .desktop file that causes the program to run in a terminal.
Also, note that hal is notified by udev via a socket. Hal, in turn, issues a dbus event. So if you want to do your own dbus listener, you could write something in Python or Ruby but it would have to run as a daemon.
All in all it would be easiest to do it from a udev rule; friendliest to do it from GNOME's dbus listener.