I want logrotate to run at a precise time daily.

Currently it is set to run at some random time using anacron and I don't want to change the randomness factor for all the other jobs.

I have logrotate in /etc/cron.daily and a line in anacrontab which executes all cron.daily jobs.

How do I reconfigure it to execute just logrotate at 23:59 daily, but to have all the other jobs executed as usual?

My initial thought was to move /etc/cron.daily/logrotate out of the directory and put it somewhere else and configure plain old cron to run it. However I want logrotate package upgrades to go through without a hitch in the future, i.e. without questions that someone else doing the upgrade might get wrong.

Is this possible?

  • We have worked around this issue, or maybe it should be called an impossibility. We now have an individual cron job for logrotate to rotate this one app's log files. Anacron also runs logrotate for everything as before. I expect at the next package upgrade for logrotate, the config will get blitzed but we'll cross that bridge when we come to it. – Adam Dec 15 '14 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.