Replace logrotate cron file with (adapted) systemd timer file (#12921)
Debian is shipping a systemd timer unit for logrotate, but we're also packaging in a cron job, which means both of them will run, potentially at the same time. Remove our cron file, and add an override to the shipped timer file to have it be run every 10 minutes. Fixes #12392. Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com> Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
This commit is contained in:
parent
fcb151319b
commit
00b11ec4e2
@ -398,6 +398,8 @@ sudo cp -f $IMAGE_CONFIGS/logrotate/logrotate.d/* $FILESYSTEM_ROOT/etc/logrotate
|
|||||||
sudo cp $IMAGE_CONFIGS/logrotate/rsyslog.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
sudo cp $IMAGE_CONFIGS/logrotate/rsyslog.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
||||||
sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||||
sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.sh $FILESYSTEM_ROOT/usr/bin/
|
sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.sh $FILESYSTEM_ROOT/usr/bin/
|
||||||
|
sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/logrotate.timer.d
|
||||||
|
sudo cp $IMAGE_CONFIGS/logrotate/timerOverride.conf $FILESYSTEM_ROOT/etc/systemd/system/logrotate.timer.d/
|
||||||
echo "logrotate-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
echo "logrotate-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||||
|
|
||||||
# Copy systemd-journald configuration files
|
# Copy systemd-journald configuration files
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
# Attempt to rotate system logs once every 10 minutes.
|
|
||||||
# First kill any logrotate process(es) if they are still running, as they're most likely hung
|
|
||||||
*/10 * * * * root /usr/bin/pkill -9 logrotate > /dev/null 2>&1; /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1
|
|
2
files/image_config/logrotate/timerOverride.conf
Normal file
2
files/image_config/logrotate/timerOverride.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Timer]
|
||||||
|
OnCalendar=*:00/10:00
|
Loading…
Reference in New Issue
Block a user