I need to run a few commands (ssh socks tunnel, and document sync) as my user when a network connection is present.

But I don't know where I can hook up such a script so that is will run when ever network-manager connects to a network.

Please someone help, I'm pretty lost!