mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-03 19:43:17 +00:00
include $today in functions and grep them to make it daily
This commit is contained in:
parent
92249365b4
commit
63a939b636
1 changed files with 14 additions and 6 deletions
20
pihole
20
pihole
|
@ -160,12 +160,14 @@ statsBlockedDomains() {
|
||||||
}
|
}
|
||||||
|
|
||||||
statsQueriesToday() {
|
statsQueriesToday() {
|
||||||
local queriesToday=$(cat /var/log/pihole.log | cut -d" " -f5 | grep query | wc -l)
|
local today=$(date "+%b %e")
|
||||||
|
local queriesToday=$(cat /var/log/pihole.log | grep "${today}" | cut -d" " -f5 | grep query | wc -l)
|
||||||
echo ${queriesToday}
|
echo ${queriesToday}
|
||||||
}
|
}
|
||||||
|
|
||||||
statsBlockedToday() {
|
statsBlockedToday() {
|
||||||
local blockedToday=$(grep /etc/pihole/gravity.list /var/log/pihole.log | grep -v read | wc -l)
|
local today=$(date "+%b %e")
|
||||||
|
local blockedToday=$(grep /etc/pihole/gravity.list /var/log/pihole.log | grep "${today}" | grep -v read | wc -l)
|
||||||
echo ${blockedToday}
|
echo ${blockedToday}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,13 +179,18 @@ stats() {
|
||||||
statsQueriesToday
|
statsQueriesToday
|
||||||
elif [[ $1 == "blocked" ]] ; then
|
elif [[ $1 == "blocked" ]] ; then
|
||||||
statsBlockedToday
|
statsBlockedToday
|
||||||
|
else
|
||||||
|
echo "::: Any heading can be called to just return that value"
|
||||||
|
echo ":::"
|
||||||
|
echo -n "::: list: "
|
||||||
|
statsBlockedDomains
|
||||||
|
echo -n "::: hits: "
|
||||||
|
statsQueriesToday
|
||||||
|
echo -n "::: blocked: "
|
||||||
|
statsBlockedToday
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
helpFunc() {
|
helpFunc() {
|
||||||
echo "::: Control all PiHole specific functions!"
|
echo "::: Control all PiHole specific functions!"
|
||||||
echo ":::"
|
echo ":::"
|
||||||
|
@ -207,6 +214,7 @@ helpFunc() {
|
||||||
echo "::: enable Enable Pi-Hole DNS Blocking"
|
echo "::: enable Enable Pi-Hole DNS Blocking"
|
||||||
echo "::: disable Disable Pi-Hole DNS Blocking"
|
echo "::: disable Disable Pi-Hole DNS Blocking"
|
||||||
echo "::: restartdns Restart dnsmasq"
|
echo "::: restartdns Restart dnsmasq"
|
||||||
|
echo "::: stats Display some statistics"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue