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() {
|
||||
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}
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
|
@ -177,13 +179,18 @@ stats() {
|
|||
statsQueriesToday
|
||||
elif [[ $1 == "blocked" ]] ; then
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
helpFunc() {
|
||||
echo "::: Control all PiHole specific functions!"
|
||||
echo ":::"
|
||||
|
@ -207,6 +214,7 @@ helpFunc() {
|
|||
echo "::: enable Enable Pi-Hole DNS Blocking"
|
||||
echo "::: disable Disable Pi-Hole DNS Blocking"
|
||||
echo "::: restartdns Restart dnsmasq"
|
||||
echo "::: stats Display some statistics"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue