Replace nc with psuedo-device

* Also fix minor conditional style issue
pull/1676/head
WaLLy3K 7 years ago committed by GitHub
parent 3125d24ded
commit 15a5f425bf

@ -485,9 +485,11 @@ Options:
statusFunc() { statusFunc() {
local addnConfigs local addnConfigs
# Determine if service is running on port 53 # Determine if service is running on port 53 (Cr: https://superuser.com/a/806331)
if nc -z 127.0.0.1 53; then if (echo > /dev/tcp/localhost/53) >/dev/null 2>&1; then
[[ "${1}" != "web" ]] && echo -e " ${TICK} DNS service is running" if [[ "${1}" != "web" ]]; then
echo -e " ${TICK} DNS service is running"
fi
else else
case "${1}" in case "${1}" in
"web") echo "-1";; "web") echo "-1";;
@ -496,7 +498,7 @@ statusFunc() {
return 0 return 0
fi fi
# Determine if any of Pi-hole's addn-hosts configs are commented out # Determine if Pi-hole's addn-hosts configs are commented out
addnConfigs=$(grep -i "addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf) addnConfigs=$(grep -i "addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf)
if [[ "${addnConfigs}" =~ "#" ]]; then if [[ "${addnConfigs}" =~ "#" ]]; then
@ -562,7 +564,7 @@ tricorderFunc() {
exit 1 exit 1
fi fi
if ! timeout 2 nc -z tricorder.pi-hole.net 9998 &> /dev/null; then if ! (echo > /dev/tcp/tricorder.pi-hole.net/9998) >/dev/null 2>&1; then
echo -e " ${CROSS} Unable to connect to Pi-hole's Tricorder server" echo -e " ${CROSS} Unable to connect to Pi-hole's Tricorder server"
exit 1 exit 1
fi fi

Loading…
Cancel
Save