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
.
参考:https://askubuntu.com/questions/24503/specify-the-time-of-daily-log-rotate