updated on Sun Jan 15 16:02:00 UTC 2012
[aur-mirror.git] / networkmanager-dispatcher-pdnsd / 00-pdnsd
blob3aa6a506ea894741e4be5fbfb45fdd1fbe1a709e
1 #!/bin/sh
3 INTERFACE=$1
4 STATUS=$2
6 pdnsd_going_up() {
7 # Check whether pDNSd is already running before starting it.
8 if [ `rc.d list|grep pdnsd|cut -f1 -d']'|cut -d'[' -f2` == 'STOPPED' ]; then
9 rc.d start
10 else
11 rc.d restart
15 pdnsd_going_down() {
16 # Check for active interface, take offline if none is active
17 if [ ! `nm-tool|grep State|cut -f2 -d' '` = 'connected' ]; then
18 rc.d stop pdnsd
19 else
20 # If another interface is active, restart so we're sure we're using
21 # the active connection.
22 rc.d restart pdnsd
26 case "$STATUS" in
27 up)
28 pdnsd_going_up
30 vpn-up)
31 pdnsd_going_up
33 down)
34 pdnsd_going_down
36 vpn-down)
37 pdnsd_going_down
39 esac