From 4d39ab9753f1df520c50b86b9d126353382f6e13 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Thu, 14 Sep 2017 16:39:25 +1000 Subject: [PATCH] Allow force-reload to be used when restarting DNS * Remove duplicate coltable variable definition and source * Minor comment modifications * Add "$2" to restartdns --- pihole | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pihole b/pihole index 61ef0e20..625ae8bb 100755 --- a/pihole +++ b/pihole @@ -12,10 +12,6 @@ readonly PI_HOLE_SCRIPT_DIR="/opt/pihole" readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" readonly colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE" - -source ${colfile} - -colfile="${PI_HOLE_SCRIPT_DIR}/COL_TABLE" source "${colfile}" # Must be root to use this tool @@ -354,8 +350,9 @@ restartDNS() { local svcOption svc str output status svcOption="${1:-}" + # Determine if we should reload or restart dnsmasq if [[ "${svcOption}" =~ "reload" ]]; then - # SIGHUP does NOT re-read any *.conf files + # Using SIGHUP will NOT re-read any *.conf files svc="killall -s SIGHUP dnsmasq" elif [[ -z "${svcOption}" ]]; then # Get PID of dnsmasq to determine if it needs to start or restart @@ -367,7 +364,7 @@ restartDNS() { svc="service dnsmasq ${svcOption}" fi - # Print output to Terminal, not Web Admin + # Print output to Terminal, but not to Web Admin str="${svcOption^}ing DNS service" [[ -t 1 ]] && echo -ne " ${INFO} ${str}..." @@ -659,7 +656,7 @@ case "${1}" in "enable" ) piholeEnable 1;; "disable" ) piholeEnable 0 "$2";; "status" ) statusFunc "$2";; - "restartdns" ) restartDNS;; + "restartdns" ) restartDNS "$2";; "-a" | "admin" ) webpageFunc "$@";; "-t" | "tail" ) tailFunc;; "checkout" ) piholeCheckoutFunc "$@";;