Re: dhcpcd putting garbage into resolv.conf
Bit Twister <BitTwister@localhost.localdomain> writes:
]same reason. Also I figured since everyone is using the first dns
]server I would use the other one. If they renumber I'll have to fix
]the sort command.
The second nameserver may be there because it is known to be slow or
unreliable, but it is a backup just in case the first one does not work. Ie
your reasoning is suspect.
]On Mandrakelinux all the scripts found in
]/etc/sysconfig/network-scripts/ifup.d/
]are executed when a device is brought up.
]You may want to remove the last copy command unless you are running
]postfix. Postfix complains if it's copy and /etc/resolv.conf dates do
]not match.
]#*************************************************
]#
]# strip_search - strip *search* line from resolv.conf
]#
]# A reverse sort to used to flip name server order.
]# Rational, everyone is using the first name server.
]#
]# Usually placed at bottom of /etc/rc.d/rc.local
]# or placed in /etc/sysconfig/network-scripts/ifup.d/
]#
]#*************************************************
]_new=/tmp/resolv.conf_new
]cp /dev/null $_new
]while read line
]do
] set -a $line
] if [ $1 != "search" ] ; then
] echo $line >> $_new
] fi
]done < /etc/resolv.conf
Uh, grep -v '^search' /etc/resolv.conf> $_new
would do the same thing much much more easily.
]sort -r -o /etc/resolv.conf $_new
]/bin/cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf
]#--------- end strip_search -----------------------
|