From 9170488b0a73a11bbc0267de6b3747dab1d80094 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 15:58:48 +0000 Subject: [PATCH 1/2] Test if DNS service is listening on local port 53 --- pihole | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pihole b/pihole index 5a54fae4..7021ab0a 100755 --- a/pihole +++ b/pihole @@ -185,6 +185,19 @@ piholeLogging() { } piholeStatus() { + if [[ $(netstat -plnt | grep -c ':53') > 0 ]]; then + if [[ "${1}" != "web" ]] ; then + echo "::: DNS service is running" + fi + else + if [[ "${1}" == "web" ]] ; then + echo "-1"; + else + echo "::: DNS service is NOT running" + fi + return + fi + if [[ $(grep -i "^#addn-hosts=/" /etc/dnsmasq.d/01-pihole.conf) ]] ; then #list is commented out if [[ "${1}" == "web" ]] ; then From d0cd39a25f919b051ff94b959b9a0982145f7f5c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 28 Dec 2016 20:32:56 +0100 Subject: [PATCH 2/2] Added space behind :53 to only match port 53 --- pihole | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pihole b/pihole index 7021ab0a..a8442edd 100755 --- a/pihole +++ b/pihole @@ -185,7 +185,7 @@ piholeLogging() { } piholeStatus() { - if [[ $(netstat -plnt | grep -c ':53') > 0 ]]; then + if [[ $(netstat -plnt | grep -c ':53 ') > 0 ]]; then if [[ "${1}" != "web" ]] ; then echo "::: DNS service is running" fi