From aa5c15a72882c5c76103363553644f8ef005bd61 Mon Sep 17 00:00:00 2001 From: Faye Duxovni Date: Fri, 9 Jul 2021 01:06:10 -0400 Subject: [PATCH 1/2] give pihole its own logrotate state file Signed-off-by: Faye Duxovni Co-authored-by: Dan Schaper --- advanced/Scripts/piholeLogFlush.sh | 11 ++++++++--- advanced/Templates/pihole.cron | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/piholeLogFlush.sh b/advanced/Scripts/piholeLogFlush.sh index 51e94d7c..5c6a2c68 100755 --- a/advanced/Scripts/piholeLogFlush.sh +++ b/advanced/Scripts/piholeLogFlush.sh @@ -11,6 +11,11 @@ colfile="/opt/pihole/COL_TABLE" source ${colfile} +# In case we're running at the same time as a system logrotate, use a +# separate logrotate state file to prevent stepping on each other's +# toes. +STATEFILE="/var/lib/logrotate/pihole" + # Determine database location # Obtain DBFILE=... setting from pihole-FTL.db # Constructed to return nothing when @@ -32,7 +37,7 @@ if [[ "$@" == *"once"* ]]; then # Nightly logrotation if command -v /usr/sbin/logrotate >/dev/null; then # Logrotate once - /usr/sbin/logrotate --force /etc/pihole/logrotate + /usr/sbin/logrotate --force --state "${STATEFILE}" /etc/pihole/logrotate else # Copy pihole.log over to pihole.log.1 # and empty out pihole.log @@ -47,8 +52,8 @@ else # Manual flushing if command -v /usr/sbin/logrotate >/dev/null; then # Logrotate twice to move all data out of sight of FTL - /usr/sbin/logrotate --force /etc/pihole/logrotate; sleep 3 - /usr/sbin/logrotate --force /etc/pihole/logrotate + /usr/sbin/logrotate --force --state "${STATEFILE}" /etc/pihole/logrotate; sleep 3 + /usr/sbin/logrotate --force --state "${STATEFILE}" /etc/pihole/logrotate else # Flush both pihole.log and pihole.log.1 (if existing) echo " " > /var/log/pihole.log diff --git a/advanced/Templates/pihole.cron b/advanced/Templates/pihole.cron index ecd1e808..37724d2e 100644 --- a/advanced/Templates/pihole.cron +++ b/advanced/Templates/pihole.cron @@ -26,7 +26,7 @@ # parameter "quiet": don't print messages 00 00 * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole flush once quiet -@reboot root /usr/sbin/logrotate /etc/pihole/logrotate +@reboot root /usr/sbin/logrotate --state /var/lib/logrotate/pihole /etc/pihole/logrotate # Pi-hole: Grab local version and branch every 10 minutes */10 * * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updatechecker local From 092e533a30dcdef6716b975bb4587f052e7ec6ed Mon Sep 17 00:00:00 2001 From: Kenneth Chew Date: Sun, 18 Jul 2021 14:31:37 -0400 Subject: [PATCH 2/2] Add `-t` option to Admin Console help dialog Signed-off-by: Kenneth Chew --- advanced/Scripts/webpage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 9f07b120..744416e7 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -44,7 +44,8 @@ Options: -e, email Set an administrative contact address for the Block Page -h, --help Show this help dialog -i, interface Specify dnsmasq's interface listening behavior - -l, privacylevel Set privacy level (0 = lowest, 3 = highest)" + -l, privacylevel Set privacy level (0 = lowest, 3 = highest) + -t, teleporter Backup configuration as an archive" exit 0 }