Re: Execute a command after connecting or disconnecting?
- From: Dan Williams <dcbw redhat com>
- To: Bill C Riemers <briemers redhat com>
- Cc: NetworkManager-list gnome org
- Subject: Re: Execute a command after connecting or disconnecting?
- Date: Fri, 19 Feb 2010 11:38:59 -0800
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]