1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 06:48:07 +00:00

Use SIGHUP instead of force-reload

This commit is contained in:
WaLLy3K 2017-08-01 20:48:43 +10:00 committed by GitHub
parent 18b41adbf6
commit cc4ada99d8

19
pihole
View File

@ -347,32 +347,33 @@ versionFunc() {
} }
restartDNS() { restartDNS() {
local svcOption str output status over local svcOption svc str output status
# Force-reload is used for "/etc/pihole/*.list" files
# Restart is needed for "/etc/dnsmasq.d/*.conf" files
svcOption="${1:-}" svcOption="${1:-}"
if [[ -z "${svcOption}" ]]; then if [[ "${svcOption}" =~ "reload" ]]; then
# SIGHUP does 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 # Get PID of dnsmasq to determine if it needs to start or restart
if pidof dnsmasq &> /dev/null; then if pidof dnsmasq &> /dev/null; then
svcOption="restart" svcOption="restart"
else else
svcOption="start" svcOption="start"
fi fi
svc="service dnsmasq ${svcOption}"
fi fi
# Only print output to Terminal, not Web Admin # Print output to Terminal, not Web Admin
str="${svcOption^}ing DNS service" str="${svcOption^}ing DNS service"
[[ -t 1 ]] && echo -ne " ${INFO} ${str}..." [[ -t 1 ]] && echo -ne " ${INFO} ${str}..."
output=$( { service dnsmasq "${svcOption}"; } 2>&1 ) output=$( { ${svc}; } 2>&1 )
status="$?" status="$?"
if [[ "$?" -eq 0 ]]; then if [[ "${status}" -eq 0 ]]; then
[[ -t 1 ]] && echo -e "${OVER} ${TICK} ${str}" [[ -t 1 ]] && echo -e "${OVER} ${TICK} ${str}"
else else
[[ ! -t 1 ]] && OVER="" [[ ! -t 1 ]] && local OVER=""
echo -e "${OVER} ${CROSS} ${output}" echo -e "${OVER} ${CROSS} ${output}"
fi fi
} }