1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Add "quiet" mode + update comments in the cron file

This commit is contained in:
DL6ER 2017-05-17 12:54:43 +02:00
parent c9042ffedd
commit 42eb811910
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
2 changed files with 10 additions and 4 deletions

View File

@ -8,6 +8,9 @@
# This file is copyright under the latest version of the EUPL. # This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license. # Please see LICENSE file for your rights under this license.
if [[ "$@" != *"quiet"* ]]; then
echo -n "::: Flushing /var/log/pihole.log ..."
fi
if [[ "$@" == *"once"* ]]; then if [[ "$@" == *"once"* ]]; then
# Nightly logrotation # Nightly logrotation
if command -v /usr/sbin/logrotate >/dev/null; then if command -v /usr/sbin/logrotate >/dev/null; then
@ -24,7 +27,6 @@ if [[ "$@" == *"once"* ]]; then
fi fi
else else
# Manual flushing # Manual flushing
echo -n "::: Flushing /var/log/pihole.log ..."
if command -v /usr/sbin/logrotate >/dev/null; then if command -v /usr/sbin/logrotate >/dev/null; then
# Logrotate twice to move all data out of sight of FTL # 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; sleep 3
@ -36,5 +38,8 @@ else
echo " " > /var/log/pihole.log.1 echo " " > /var/log/pihole.log.1
fi fi
fi fi
fi
if [[ "$@" != *"quiet"* ]]; then
echo "... done!" echo "... done!"
fi fi

View File

@ -21,9 +21,10 @@
# Pi-hole: Update Pi-hole! Uncomment to enable auto update # Pi-hole: Update Pi-hole! Uncomment to enable auto update
#30 2 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updatePihole #30 2 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updatePihole
# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control # Pi-hole: Flush the log daily at 00:00
# Stats will be viewable in the Web interface thanks to the cron job above
# The flush script will use logrotate if available # The flush script will use logrotate if available
00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush once # parameter "once": logrotate only once (default is twice)
# parameter "quiet": don't print messages
00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush once quiet
@reboot root /usr/sbin/logrotate /etc/pihole/logrotate @reboot root /usr/sbin/logrotate /etc/pihole/logrotate