logrotate not working, what cronjob triggers /usr/sbin/logrotate /etc/logrotate.conf ?
Hello,
I have recently noticed that some of the new Cloudlinux 9 cPanel servers I setup a few weeks ago do not run logrotate properly and automatically, while some others do.
/var/log/messages /var/log/exim_mainlog etc are not rotated.
When I run logrotate -f /etc/logrotate.conf manually, the logs are getting rotated, so the problem seems to be that the command that runs logrotate is not triggered.
I compared the cron jobs between the working servers and the not-working ones, but I couldn't see a difference.
I searched in all cron folders (cron.d/cron.daily/cron.hourly/cron.monthly/crontab/cron.weekly/root user cron, etc.) but could not find any cronjob running the logrotate command.
On my Cloudlinux 8 servers, there is a /etc/cron.daily/logrotate file while on my Cloudlinux 9 servers this particular file doesn't exist, but somehow the logrotate still gets triggered on some servers.
So my question is, what cronjob triggers the command to run logrotate (supposing it is /usr/sbin/logrotate /etc/logrotate.conf) on Cloudlinux 9?. If it's not getting triggered by a cron job, is there any other service or a daemon that fires logrotate?
Thank you in advance.
-
After checking out a post on reddit, the issue seems to be that the AlmaLinux9 has a dedicated service by the name of "logrotate.timer" which was inactive on my servers. To enable the timer I used the following commands:
systemctl start logrotate.timer
systemctl enable logrotate.timer
So there's no actual cronjob that triggers the logrotate but instead there is a systemd timer.
Original post: https://www.reddit.com/r/AlmaLinux/comments/1fwogp6/comment/lqgqa66
0 -
That's an interesting find and useful bit of knowledge to know. Thanks for sharing.
0
Please sign in to leave a comment.
Comments
2 comments