Install customized version of logrotate script

This commit is contained in:
DL6ER 2017-01-27 14:16:24 +01:00
parent 9a3cf949cf
commit 6fd7e0311c
No known key found for this signature in database
GPG key ID: BB8EC0BC77973A30
3 changed files with 16 additions and 2 deletions

View file

@ -13,7 +13,7 @@
echo -n "::: Flushing /var/log/pihole.log ..." echo -n "::: Flushing /var/log/pihole.log ..."
# Test if logrotate is available on this system # Test if logrotate is available on this system
if command -v /usr/sbin/logrotate &> /dev/null; then if command -v /usr/sbin/logrotate &> /dev/null; then
/usr/sbin/logrotate --force /etc/.pihole/advanced/logrotate /usr/sbin/logrotate --force /etc/pihole/logrotate
else else
echo " " > /var/log/pihole.log echo " " > /var/log/pihole.log
fi fi

View file

@ -26,4 +26,4 @@
# 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 00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush
@reboot root /usr/sbin/logrotate /etc/.pihole/advanced/logrotate @reboot root /usr/sbin/logrotate /etc/pihole/logrotate

View file

@ -934,6 +934,18 @@ finalExports() {
fi fi
} }
installLogrotate() {
# Install the logrotate script
echo ":::"
echo -n "::: Installing latest logrotate script..."
cp /etc/.pihole/advanced/logrotate /etc/pihole/logrotate
# Raspbian will use the default "su root root"
# Ubuntu will use a custom user/group "su root syslog"
# We read the global config file and copy what we find into our file
echo $(sed '/^su/!d' /etc/logrotate.conf) >> /etc/pihole/logrotate
echo " done!"
}
installPihole() { installPihole() {
# Install base files and web interface # Install base files and web interface
create_pihole_user create_pihole_user
@ -953,6 +965,7 @@ installPihole() {
CreateLogFile CreateLogFile
installPiholeWeb installPiholeWeb
installCron installCron
installLogrotate
configureFirewall configureFirewall
finalExports finalExports
runGravity runGravity
@ -983,6 +996,7 @@ updatePihole() {
CreateLogFile CreateLogFile
installPiholeWeb installPiholeWeb
installCron installCron
installLogrotate
finalExports #re-export setupVars.conf to account for any new vars added in new versions finalExports #re-export setupVars.conf to account for any new vars added in new versions
runGravity runGravity
} }