From 567f8915962316dfee3b040bad404da7cdcbbe38 Mon Sep 17 00:00:00 2001 From: Rachid Koucha <47061324+Rachid-Koucha@users.noreply.github.com> Date: Sun, 27 Jan 2019 13:46:48 +0100 Subject: [PATCH] /etc/resolv.conf grows indefinitely This file grows indefinitely : upon each DHCP lease renew, the "nameserver ..dns..." line is added at the end of the file. Make a "grep" in the file to make sure that the same line does not already exist. Signed-off-by: Rachid Koucha --- templates/lxc-busybox.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in index 2171e2d59..3782687a5 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in @@ -164,7 +164,10 @@ case "\$1" in [ -n "\$domain" ] && echo search \$domain > /etc/resolv.conf for i in \$dns ; do - echo nameserver \$i >> /etc/resolv.conf + grep "nameserver \$i" /etc/resolv.conf > /dev/null 2>&1 + if [ \$? -ne 0 ]; then + echo nameserver \$i >> /etc/resolv.conf + fi done ;; esac -- 2.47.2