mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-05 05:30:55 +00:00
Prevent Web Admin from printing restartdns colour codes (#1575)
* Prevent Web Admin from printing unnecessary msgs * Make DNS restart behaviour consistent
This commit is contained in:
parent
e1f818ffb7
commit
3631d1349e
@ -221,18 +221,19 @@ Reboot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RestartDNS() {
|
RestartDNS() {
|
||||||
local str="Restarting dnsmasq"
|
local str="Restarting DNS service"
|
||||||
echo -ne " ${INFO} ${str}..."
|
[[ -t 1 ]] && echo -ne " ${INFO} ${str}"
|
||||||
if [[ -x "$(command -v systemctl)" ]]; then
|
if command -v systemctl &> /dev/null; then
|
||||||
systemctl restart dnsmasq
|
output=$( { systemctl restart dnsmasq; } 2>&1 )
|
||||||
else
|
else
|
||||||
service dnsmasq restart
|
output=$( { service dnsmasq restart; } 2>&1 )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$?" == 0 ]]; then
|
if [[ -z "${output}" ]]; then
|
||||||
echo -e "${OVER} ${TICK} ${str}"
|
[[ -t 1 ]] && echo -e "${OVER} ${TICK} ${str}"
|
||||||
else
|
else
|
||||||
echo -e "${OVER} ${CROSS} ${str}"
|
[[ ! -t 1 ]] && OVER=""
|
||||||
|
echo -e "${OVER} ${CROSS} ${output}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
pihole
24
pihole
@ -173,24 +173,32 @@ versionFunc() {
|
|||||||
|
|
||||||
restartDNS() {
|
restartDNS() {
|
||||||
dnsmasqPid=$(pidof dnsmasq)
|
dnsmasqPid=$(pidof dnsmasq)
|
||||||
|
local str="Restarting DNS service"
|
||||||
|
echo -ne " ${INFO} ${str}"
|
||||||
if [[ "${dnsmasqPid}" ]]; then
|
if [[ "${dnsmasqPid}" ]]; then
|
||||||
# Service already running - reload config
|
# Service already running - reload config
|
||||||
echo -ne " ${INFO} Restarting dnsmasq"
|
|
||||||
if [[ -x "$(command -v systemctl)" ]]; then
|
if [[ -x "$(command -v systemctl)" ]]; then
|
||||||
systemctl restart dnsmasq
|
output=$( { systemctl restart dnsmasq; } 2>&1 )
|
||||||
else
|
else
|
||||||
service dnsmasq restart
|
output=$( { service dnsmasq restart; } 2>&1 )
|
||||||
|
fi
|
||||||
|
if [[ -z "${output}" ]]; then
|
||||||
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
|
else
|
||||||
|
echo -e "${OVER} ${CROSS} ${output}"
|
||||||
fi
|
fi
|
||||||
[[ "$?" == 0 ]] && echo -e "${OVER} ${TICK} Restarted dnsmasq" || echo -e "${OVER} ${CROSS} Failed to restart dnsmasq"
|
|
||||||
else
|
else
|
||||||
# Service not running, start it up
|
# Service not running, start it up
|
||||||
echo -ne " ${INFO} Starting dnsmasq"
|
|
||||||
if [[ -x "$(command -v systemctl)" ]]; then
|
if [[ -x "$(command -v systemctl)" ]]; then
|
||||||
systemctl start dnsmasq
|
output=$( { systemctl start dnsmasq; } 2>&1 )
|
||||||
else
|
else
|
||||||
service dnsmasq start
|
output=$( { service dnsmasq start; } 2>&1 )
|
||||||
|
fi
|
||||||
|
if [[ -z "${output}" ]]; then
|
||||||
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
|
else
|
||||||
|
echo -e "${OVER} ${CROSS} ${output}"
|
||||||
fi
|
fi
|
||||||
[[ "$?" == 0 ]] && echo -e "${OVER} ${TICK} Restarted dnsmasq" || echo -e "${OVER} ${CROSS} Failed to restart dnsmasq"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user