logrotate配置了一个daily切割的配置,但发现是凌晨3点多切割的,这个默认的时间在哪儿设置?
logrotate的行为也是受crontab控制,在/etc/cron.daily目录下。
而crontab任务是受anacron控制,在/etc/anacron文件中配置:
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
这里写的很清楚START_HOURS_RANGE=3-22,就是在3点到22点之间选择一个时间执行任务。
那这下也就明白为啥是凌晨3点多切割日志了。你可以修改这儿,或者把你需要自定义时间logrotate的切割任务单拉出来,自己写一个定时的crontab执行。