Allow force-reload to be used when restarting DNS

* Remove duplicate coltable variable definition and source
* Minor comment modifications
* Add "$2" to restartdns
This commit is contained in:
WaLLy3K 2017-09-14 16:39:25 +10:00 committed by GitHub
parent a5c4ae955a
commit 4d39ab9753

11
pihole
View file

@ -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 "$@";;