i'm not using network manager and require a method of bringing up a VPN connection only when connected to wireless. when wireless is disconnected and a wired connection resumes the VPN connection needs to be terminated.

the current setup I have is using ifplugd to manage both the wired and wireless connections and to switch between them when a connection is lost this helped http://ubuntuforums.org/archive/index.php/t-43766.html. However i also require a VPN connection to be estsblished to use the wireless network

if anyone knows of a script or something that could achieve this that would be great.