From 43007592873b31538e1ed816c83d8b3dd8b1792a Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 3 Nov 2016 08:01:25 +0000 Subject: [PATCH] Fix logic. If both v6 and v4 divide by two, else dont. --- advanced/Scripts/chronometer.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 16ff6fb6..2e6cabda 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -21,12 +21,11 @@ today=$(date "+%b %e") CalcBlockedDomains() { if [ -e "${gravity}" ]; then - #Are we IPV6 or IPV4? - if [[ -n "${IPV6_ADDRESS}" ]]; then - #We are IPV6 + # if BOTH IPV4 and IPV6 are in use, then we need to divide total domains by 2. + if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]]; then blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1/2}') else - #We are IPV4 + # only one is set. blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1}') fi else @@ -104,8 +103,6 @@ normalChrono() { CalcBlockedDomains echo "Blocking: ${blockedDomainsTotal}" - #below commented line does not add up to todaysQueryCount - #echo "Queries: $todaysQueryCountV4 / $todaysQueryCountV6" echo "Queries: ${queriesToday}" #same total calculation as dashboard echo "Pi-holed: ${blockedToday} (${percentBlockedToday}%)"