From 75283404bcb725141e6ca8db5687f45ec79cfcdc Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Fri, 3 Jan 2025 18:16:57 +0100 Subject: [PATCH] make sure to run logrotate 4 times per day instead of just once during night and also create a maximum of two rotated copies per logfile so that on a busy system logfiles won't overrun the /var filesystem (refs https://github.com/jens-maus/RaspberryMatic/discussions/2970) --- buildroot-external/overlay/base-raspmatic/etc/crontab.root | 2 +- buildroot-external/overlay/base-raspmatic_lxc/etc/crontab.root | 2 +- buildroot-external/overlay/base-raspmatic_oci/etc/crontab.root | 2 +- buildroot-external/overlay/base/etc/crontab.root | 2 +- buildroot-external/overlay/base/etc/logrotate.d/syslogd.conf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buildroot-external/overlay/base-raspmatic/etc/crontab.root b/buildroot-external/overlay/base-raspmatic/etc/crontab.root index 4e63ded1ef..ea09429845 100644 --- a/buildroot-external/overlay/base-raspmatic/etc/crontab.root +++ b/buildroot-external/overlay/base-raspmatic/etc/crontab.root @@ -1,6 +1,6 @@ */11 * * * * [ -c /dev/rtc0 ] && /sbin/hwclock --systohc --utc 1 3,9,15,21 * * * [ ! -e /usr/local/HMLGW ] && /bin/SetInterfaceClock -0 4 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" +0 4,10,16,22 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" */1 * * * * /bin/updateDCVars.tcl >/dev/null 2>/dev/null 7 0 * * * /bin/nice /bin/cronBackup.sh >/dev/null 2>/dev/null 0 4 * * 6 [ ! -e /etc/config/NoFSTRIM ] && /bin/nice /sbin/fstrim --listed-in /etc/fstab:/proc/self/mountinfo --verbose --quiet-unsupported | logger -p info -t fstrim diff --git a/buildroot-external/overlay/base-raspmatic_lxc/etc/crontab.root b/buildroot-external/overlay/base-raspmatic_lxc/etc/crontab.root index 6e3cc21e8b..b8dfe6d788 100644 --- a/buildroot-external/overlay/base-raspmatic_lxc/etc/crontab.root +++ b/buildroot-external/overlay/base-raspmatic_lxc/etc/crontab.root @@ -1,5 +1,5 @@ 1 3,9,15,21 * * * /bin/SetInterfaceClock -0 4 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" +0 4,10,16,22 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" */1 * * * * /bin/updateDCVars.tcl >/dev/null 2>/dev/null 7 0 * * * /bin/nice /bin/cronBackup.sh >/dev/null 2>/dev/null */10 * * * * [ -d /media/usb0/measurement ] && /bin/nice /usr/bin/rsync -aogX --delete-after --no-whole-file --checksum /tmp/measurement/ /media/usb0/measurement/ >/dev/null 2>/dev/null diff --git a/buildroot-external/overlay/base-raspmatic_oci/etc/crontab.root b/buildroot-external/overlay/base-raspmatic_oci/etc/crontab.root index ad6cadadf5..a722965ce7 100644 --- a/buildroot-external/overlay/base-raspmatic_oci/etc/crontab.root +++ b/buildroot-external/overlay/base-raspmatic_oci/etc/crontab.root @@ -1,5 +1,5 @@ 1 3,9,15,21 * * * [ ! -e /usr/local/HMLGW ] && /bin/SetInterfaceClock -0 4 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" +0 4,10,16,22 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" */1 * * * * /bin/updateDCVars.tcl >/dev/null 2>/dev/null 7 0 * * * /bin/nice /bin/cronBackup.sh >/dev/null 2>/dev/null */10 * * * * [ -d /media/usb0/measurement ] && /bin/nice /usr/bin/rsync -aogX --delete-after --no-whole-file --checksum /tmp/measurement/ /media/usb0/measurement/ >/dev/null 2>/dev/null diff --git a/buildroot-external/overlay/base/etc/crontab.root b/buildroot-external/overlay/base/etc/crontab.root index aa6112fe3e..a0c639b6bf 100644 --- a/buildroot-external/overlay/base/etc/crontab.root +++ b/buildroot-external/overlay/base/etc/crontab.root @@ -1,3 +1,3 @@ */11 * * * * [ -c /dev/rtc0 ] && /sbin/hwclock --systohc --utc 14 4 * * * /bin/SetInterfaceClock -0 4 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" +0 4,10,16,22 * * * /usr/sbin/logrotate /etc/logrotate.conf || logger -p error -t "logrotate" "logrotate aborted with error $?" diff --git a/buildroot-external/overlay/base/etc/logrotate.d/syslogd.conf b/buildroot-external/overlay/base/etc/logrotate.d/syslogd.conf index 2f22042871..8e1e0e5d47 100644 --- a/buildroot-external/overlay/base/etc/logrotate.d/syslogd.conf +++ b/buildroot-external/overlay/base/etc/logrotate.d/syslogd.conf @@ -1,7 +1,7 @@ /var/log/*.log /var/log/*/*.log /var/log/messages /var/log/messages.1 { size 2M copytruncate - rotate 1 + rotate 2 compress missingok }