On Fri, 2010-02-19 at 09:43 -0500, Bill C Riemers wrote:
> Is there a way to automatically execute a command after opening or
> closing a connection?
> 
> What I would like to do is figure out a way to run "service dnsmasq
> restart" when connecting or disconnecting from openvpn.   That way my
> dns will not continue to cache lookups across this action.

'man NetworkManager' should have the details; look for the bits about
"dispatcher" scripts.  You're looking for the 'vpn-up' and 'vpn-down'
signals specifically.  Basically drop this
into /etc/NetworkManager/dispatcher.d, make it owned by root, and make
sure it's not writable by other users or setuid:

#!/bin/sh

export LC_ALL=C

if [ "$2" = "vpn-down" ]; then
    <do something>
fi

if [ "$2" = "up" ]; then
    <do something else>
fi


_______________________________________________
NetworkManager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to