Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed that daily log rotations which are listed under /etc/logrotate.d/ are executed in the morning around 6:40 am. This is clear from the beginning and ending of the log files. Can I customize this time and set it to midnight for example?

It is nice to have one log file per day.

I am using ubuntu server 10.04 if that matters.

share|improve this question
up vote 16 down vote accepted

Edit the line that says

25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

in /etc/crontab so that the 25 6 reads 0 0. This will make it so that all scripts in /etc/cron.daily runs at midnight.

If you only want to make logrotate run at midnight, move /etc/cron.daily/logrotate to some other directory, and add the line

0 0    * * *   root    /new/path/to/logrotate/script

at the end of /etc/crontab.

share|improve this answer
You might also want to make corresponding changes to the weekly and monthly lines in the same file. I'm guessing that keeping them in the same relative order (daily, weekly, monthly) and spacing is a good idea. – nealmcb Feb 13 '11 at 7:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.