Changeset 14164 in hybrid for branches/releng-11/nanobsd
- Timestamp:
- May 9, 2018, 9:43:34 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-11/nanobsd/files/tools/nameserver-shuffle
r14145 r14164 28 28 # Get enabled DYNAMIC LIST nameservers 29 29 sed "1,\+$TAG+d" /etc/resolv.conf > $DYNLIST || exit 1 30 NAMESERVERS=`awk '/^nameserver/ {print $2}' $DYNLIST ` || exit 130 NAMESERVERS=`awk '/^nameserver/ {print $2}' $DYNLIST | sort -u` || exit 1 31 31 32 32 # Only do something if we have dynamic nameservers … … 48 48 49 49 # Output sorted list 50 NAMESERVERS=`sort -n $RESULTLIST | awk '{print $2}'`50 NAMESERVERS=`sort -n $RESULTLIST | uniq -f 1 | awk '{print $2}'` 51 51 for NAMESERVER in $NAMESERVERS; do 52 QUERY_TIME=`grep "${NAMESERVER}$" $RESULTLIST | cut -d' ' -f1`53 [ $QUERY_TIME= "9999" ] && STATUS="Query time: down" || STATUS="Query time: $QUERY_TIME"52 QUERY_TIME=`grep -m 1 "${NAMESERVER}$" $RESULTLIST | cut -d' ' -f1` 53 [ "$QUERY_TIME" = "9999" ] && STATUS="Query time: down" || STATUS="Query time: $QUERY_TIME" 54 54 # awk magic to get maximum length of comment field (for display purposes). 55 55 ML=`awk '/^nameserver/ {l=length($4);if (l>ml){ml=l}}END{print ml}' $DYNLIST` … … 67 67 68 68 # Update unbound forwarders list 69 unbound-control forward $(awk '/^nameserver 172/ {print $2}' /etc/resolv.conf | head -3)69 unbound-control forward $(awk '/^nameserver 172/ {print $2}' /etc/resolv.conf | uniq | head -3) 70 70 fi
Note:
See TracChangeset
for help on using the changeset viewer.