From f964aff9b0dd72a14f1b869ba7d5b2fd3094dc9f Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 14 Jan 2016 11:27:55 +0000 Subject: [PATCH] Changed dnsmasq restart handling to be the same as gravity.sh --- advanced/Scripts/whitelist.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index f66f56d0..2ad58869 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -52,6 +52,16 @@ if [[ "$combopattern" != "" ]]; then sed -r -i '/'"$pattern"'/d' $adList echo "** $# domain(s) whitelisted." - # Force dnsmasq to reload /etc/pihole/gravity.list - kill -HUP $(pidof dnsmasq) + # Reload hosts file + echo "** Refresh lists in dnsmasq..." + + dnsmasqPid=$(pidof dnsmasq) + + if [[ $dnsmasqPid ]]; then + # service already running - reload config + sudo kill -HUP $dnsmasqPid + else + # service not running, start it up + sudo service dnsmasq start + fi fi