Hello everyone,
The logrotate.timer does not work cyclically in Tinker Edge R Debian 10 V2.0.5. This problem causes the log file to become large and take up drive space.
On this OS, logrotate is executed by systemd, not cron.
I understand that the essence of the problem is that logrotate.timer is not enabled.
$ systemctl status logrotate.timer
* logrotate.timer - Daily rotation of log files
Loaded: loaded (/lib/systemd/system/logrotate.timer; enabled; vendor preset: enabled)
Active: inactive (dead)
Trigger: n/a
Docs: man:logrotate(8)
man:logrotate.conf(5)
Looking at the configuration file, the timer should run once a day.
$ systemctl cat logrotate.timer
# /lib/systemd/system/logrotate.timer
[Unit]
Description=Daily rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
[Timer]
OnCalendar=daily
AccuracySec=12h
Persistent=true
[Install]
WantedBy=timers.target
It appears in the timer list, but there is no execution history.
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
n/a n/a n/a n/a anacron.timer anacron.service
n/a n/a n/a n/a apt-daily-upgrade.timer apt-daily-upgrade.service
n/a n/a n/a n/a apt-daily.timer apt-daily.service
n/a n/a n/a n/a fstrim.timer fstrim.service
n/a n/a n/a n/a logrotate.timer logrotate.service
I have tried start logrotate.timer, but this command never completes.
$ sudo systemctl start logrotate.timer
I have confirmed that logrotate can be run manually.
$ sudo /usr/sbin/logrotate -v /etc/logrotate.conf
There is an option to edit /etc/cron.daily/logrotate to ignore the systemd timer and run logrotate in cron, but I consider this a last resort.
Could anyone please share the steps to start logrotate.timer? Thank you in advance for your assistance.