Ubuntu – way to run a script every time I connect to a specifc wireless network


There is a specific wireless network I connect to that requires me to use vpnc to access the internet. If I make a script to do this, is there a way to set it up so every time I connect to this network, the script is run? To be clear, I don't want this script run with most wireless connections, just one specific one.

Best Answer

You can use upstart for this. Upstart is able to catch the event of connecting to a wireless network (or a network in general) and use that as the prerequisite for running your script.

Upstart is already used by lots of scripts in Ubuntu and will eventually replace all the System V init scripts at bootup time.