From 68cb0782c05c1ba6701a8bc02f3332ab6260ee56 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Fri, 18 Nov 2016 13:27:06 -0800 Subject: [PATCH] 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!"