29 lines
598 B
Bash
Executable File
29 lines
598 B
Bash
Executable File
#!/bin/bash
|
|
|
|
NAMED_CONF="/etc/bind/named.conf.options"
|
|
|
|
[ "$USEPEERDNS" ] || exit 0
|
|
[ "$DNS1" -a "$DNS2" ] || exit 0
|
|
|
|
# replace forwarders
|
|
awk '/forwarders {/ { active = 1; print } \
|
|
/};/ { \
|
|
if ( active == 1 ) { \
|
|
active = 0; \
|
|
print "\t\t" f1 ";"; \
|
|
print "\t\t" f2 ";"; \
|
|
} \
|
|
} \
|
|
{ \
|
|
if ( active == 0 ) \
|
|
print; \
|
|
} ' \
|
|
f1=$DNS1 f2=$DNS2 $NAMED_CONF > ${NAMED_CONF}.${PPP_IFACE}
|
|
|
|
mv ${NAMED_CONF}.${PPP_IFACE} $NAMED_CONF
|
|
|
|
# restart if running
|
|
[ -f "/var/run/bind/run/named.pid" ] && rdnc reconfig
|
|
|
|
exit 0
|