Run Different Programs On Connecting and Disconnecting From Networks with Both WICD and Network-Manager in Linux
It is (unimaginatively) named networkcontrol-wicd-networkmanager, but I affectionately call it "Bob". It's what I use so that I have the right settings for Wondershaper and it doesn't bother trying to call up CrashPlan when I'm at work.
When you connect to a network, this script gets called, determines if it recognizes the network, and then launches whatever programs you want. It also will run other programs on disconnect, and has a variable delay... so that if you plug into your wired connection it doesn't shut down and start up programs when you don't need it to.
It also runs with both of the big networking programs for linux - wicd and network-manager - so you don't have to worry about how so much as just getting it done. It also writes (some minimal) output to the messages.log.
This is another one of those things that looks super complicated...but it was actually harder making it so it'd work for other people than it was to get it running at all.
The installation instructions are in two parts - the actual commands to install the files, and then how to configure the configuration file.
The program is on GitHub, and should play nicely on *nix systems. If someone knows what the equivalent is for Macs, we could do something similar there.