mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 04:30:55 +00:00
Merge pull request #4810 from pi-hole/tweak/logrotate
Fix broken logrotate config by updating old paths in existing file if they exist
This commit is contained in:
commit
d6c48f80f4
@ -1955,6 +1955,16 @@ installLogrotate() {
|
|||||||
|
|
||||||
printf "\\n %b %s..." "${INFO}" "${str}"
|
printf "\\n %b %s..." "${INFO}" "${str}"
|
||||||
if [[ -f ${target} ]]; then
|
if [[ -f ${target} ]]; then
|
||||||
|
|
||||||
|
# Account for changed logfile paths from /var/log -> /var/log/pihole/ made in core v5.11.
|
||||||
|
if grep -q "/var/log/pihole.log" ${target} || grep -q "/var/log/pihole-FTL.log" ${target}; then
|
||||||
|
sed -i 's/\/var\/log\/pihole.log/\/var\/log\/pihole\/pihole.log/g' ${target}
|
||||||
|
sed -i 's/\/var\/log\/pihole-FTL.log/\/var\/log\/pihole\/FTL.log/g' ${target}
|
||||||
|
|
||||||
|
printf "\\n\\t%b Old log file paths updated in existing logrotate file. \\n" "${INFO}"
|
||||||
|
return 3
|
||||||
|
fi
|
||||||
|
|
||||||
printf "\\n\\t%b Existing logrotate file found. No changes made.\\n" "${INFO}"
|
printf "\\n\\t%b Existing logrotate file found. No changes made.\\n" "${INFO}"
|
||||||
# Return value isn't that important, using 2 to indicate that it's not a fatal error but
|
# Return value isn't that important, using 2 to indicate that it's not a fatal error but
|
||||||
# the function did not complete.
|
# the function did not complete.
|
||||||
|
Loading…
Reference in New Issue
Block a user