From a95ce11ca68c7e9e0decdc0ed451a6fbc0384c1f Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 17 Nov 2016 10:39:51 -0800 Subject: [PATCH 1/4] Add debug timeoute --- advanced/Scripts/piholeDebug.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index fd4b475d..375fb927 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -27,7 +27,7 @@ PIHOLELOG="/var/log/pihole.log" WHITELISTMATCHES="/tmp/whitelistmatches.list" IPV6_READY=false - +TIMEOUT=60 # Header info and introduction cat << EOM ::: Beginning Pi-hole debug at $(date)! @@ -356,9 +356,10 @@ dumpPiHoleLog() { echo -e "::: Try loading a site that you are having trouble with now from a client web browser.. \n:::\t(Press CTRL+C to finish logging.)" header_write "pihole.log" if [ -e "${PIHOLELOG}" ]; then + # Dummy process to use for flagging down tail to terminate + sleep ${TIMEOUT} & while true; do - tail -f "${PIHOLELOG}" >> ${DEBUG_LOG} - log_write "" + tail -n0 -f --pid=$! "${PIHOLELOG}" >> ${DEBUG_LOG} done else log_write "No pihole.log file found!" From 6d2c5b23122dc7ffc4be5981cb5ceaa95561836d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 17 Nov 2016 10:58:58 -0800 Subject: [PATCH 2/4] Add debug timeoute --- advanced/Scripts/piholeDebug.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 375fb927..b39d038c 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -27,7 +27,7 @@ PIHOLELOG="/var/log/pihole.log" WHITELISTMATCHES="/tmp/whitelistmatches.list" IPV6_READY=false -TIMEOUT=60 +TIMEOUT=15 # Header info and introduction cat << EOM ::: Beginning Pi-hole debug at $(date)! @@ -358,9 +358,7 @@ dumpPiHoleLog() { if [ -e "${PIHOLELOG}" ]; then # Dummy process to use for flagging down tail to terminate sleep ${TIMEOUT} & - while true; do - tail -n0 -f --pid=$! "${PIHOLELOG}" >> ${DEBUG_LOG} - done + tail -n0 -f --pid=$! "${PIHOLELOG}" >> ${DEBUG_LOG} else log_write "No pihole.log file found!" printf ":::\tNo pihole.log file found!\n" From 0f4c8d4923a2d55d357e89aefaed802ed4d537f3 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 17 Nov 2016 11:00:11 -0800 Subject: [PATCH 3/4] Set default timeout to 60 seconds --- advanced/Scripts/piholeDebug.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index b39d038c..c91edf2a 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -27,7 +27,7 @@ PIHOLELOG="/var/log/pihole.log" WHITELISTMATCHES="/tmp/whitelistmatches.list" IPV6_READY=false -TIMEOUT=15 +TIMEOUT=60 # Header info and introduction cat << EOM ::: Beginning Pi-hole debug at $(date)! From 68cb0782c05c1ba6701a8bc02f3332ab6260ee56 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 18 Nov 2016 13:27:06 -0800 Subject: [PATCH 4/4] Add countdown timer --- advanced/Scripts/piholeDebug.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index c91edf2a..d0e60177 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -316,6 +316,16 @@ debugLighttpd() { echo ":::" } +countdown() { + tuvix=${TIMEOUT} + printf "::: Logging will automatically teminate in ${TIMEOUT} seconds\n" + while [ $tuvix -ge 1 ] + do + printf ":::\t${tuvix} seconds left. \r" + sleep 5 + tuvix=$(( tuvix - 5 )) + done +} ### END FUNCTIONS ### # Gather version of required packages / repositories @@ -357,7 +367,7 @@ dumpPiHoleLog() { header_write "pihole.log" if [ -e "${PIHOLELOG}" ]; then # Dummy process to use for flagging down tail to terminate - sleep ${TIMEOUT} & + countdown & tail -n0 -f --pid=$! "${PIHOLELOG}" >> ${DEBUG_LOG} else log_write "No pihole.log file found!"