|
|
|
@ -9,9 +9,24 @@
|
|
|
|
|
# Please see LICENSE file for your rights under this license.
|
|
|
|
|
|
|
|
|
|
echo -n "::: Flushing /var/log/pihole.log ..."
|
|
|
|
|
# Test if logrotate is available on this system
|
|
|
|
|
if [[ "$@" == *"once"* ]]; then
|
|
|
|
|
# Nightly logrotation
|
|
|
|
|
if command -v /usr/sbin/logrotate >/dev/null; then
|
|
|
|
|
# Flush twice to move all data out of sight of FTL
|
|
|
|
|
# Logrotate once
|
|
|
|
|
/usr/sbin/logrotate --force /etc/pihole/logrotate
|
|
|
|
|
else
|
|
|
|
|
# Copy pihole.log over to pihole.log.1
|
|
|
|
|
# and empty out pihole.log
|
|
|
|
|
# Note that moving the file is not an option, as
|
|
|
|
|
# dnsmasq would happily continue writing into the
|
|
|
|
|
# moved file (it will have the same file handler)
|
|
|
|
|
cp /var/log/pihole.log /var/log/pihole.log.1
|
|
|
|
|
echo " " > /var/log/pihole.log
|
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
|
else
|
|
|
|
@ -21,4 +36,5 @@ else
|
|
|
|
|
echo " " > /var/log/pihole.log.1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
echo "... done!"
|
|
|
|
|