2015-12-06 13:55:50 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-01-30 20:12:40 +00:00
|
|
|
# Pi-hole: A black hole for Internet advertisements
|
2017-02-22 17:55:20 +00:00
|
|
|
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
|
|
# Network-wide ad blocking via your own hardware.
|
|
|
|
#
|
2017-04-17 19:25:15 +00:00
|
|
|
# Flushes Pi-hole's log file
|
2015-12-06 13:55:50 +00:00
|
|
|
#
|
2017-02-22 17:55:20 +00:00
|
|
|
# This file is copyright under the latest version of the EUPL.
|
|
|
|
# Please see LICENSE file for your rights under this license.
|
|
|
|
|
2016-04-03 17:27:18 +00:00
|
|
|
echo -n "::: Flushing /var/log/pihole.log ..."
|
2017-01-12 19:39:25 +00:00
|
|
|
# Test if logrotate is available on this system
|
2017-05-12 20:39:55 +00:00
|
|
|
if command -v /usr/sbin/logrotate >/dev/null; then
|
2017-04-17 19:25:15 +00:00
|
|
|
# Flush twice to move all data out of sight of FTL
|
2017-05-12 20:39:55 +00:00
|
|
|
/usr/sbin/logrotate --force /etc/pihole/logrotate; sleep 3
|
2017-01-27 13:16:24 +00:00
|
|
|
/usr/sbin/logrotate --force /etc/pihole/logrotate
|
2017-01-12 19:39:25 +00:00
|
|
|
else
|
2017-04-17 19:25:15 +00:00
|
|
|
# Flush both pihole.log and pihole.log.1 (if existing)
|
2017-01-12 19:39:25 +00:00
|
|
|
echo " " > /var/log/pihole.log
|
2017-04-17 19:25:15 +00:00
|
|
|
if [ -f /var/log/pihole.log.1 ]; then
|
|
|
|
echo " " > /var/log/pihole.log.1
|
|
|
|
fi
|
2017-01-12 19:39:25 +00:00
|
|
|
fi
|
2016-04-03 17:27:18 +00:00
|
|
|
echo "... done!"
|