Specify the time of daily log rotate

Edit in /etc/crontab the line that says

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

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.


If you have Webmin/Virtualmin installed on your server you can change your logrotate execution time easier:

Just go to Webmin -> Scheduled Cron Jobs and Select daily cron. Modify it as you want and save it.