在CentOS 6.0 下,Apache Log 每次 rotate 的時間, 都是早上 3~22, 要修改 Log Rotate 的時間, 要從哪改呢?
Red Hat Enterprise Linux 6 includes the cronie package as a replacement for vixie-cron. The main difference between these packages is how the regular jobs (daily, weekly, monthly) are done. Cronie uses the /etc/anacrontab file, which by default looks like the following:
QUOTE:
# 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
These regular jobs will be executed once a day in the 03:00-22:00 time interval, including a random delay. For example, cron.daily will have a 5 minute forced delay plus a random delay of 0-45 minutes. You could also run jobs with no delays, between 8 and 9:
QUOTE:
RANDOM_DELAY=0 # or don't use this option at all
START_HOURS_RANGE=8-9
# period in days delay in minutes job-identifier command
1 0 cron.daily nice run-parts /etc/cron.daily
7 0 cron.weekly nice run-parts /etc/cron.weekly
@monthly 0 cron.monthly nice run-parts /etc/cron.monthly
如果你不想使用預設的 cronie-anacron ...那你也可以改用別的套件...
if you want more fine grained control you could just ditch anacron altogether and use /etc/cron.d/dailyjobs
QUOTE:
yum remove cronie-anacron
yum install cronie-noanacron sysstat
不要忘記 start crond
QUOTE:
service crond start
chkconfig crond on
再檢查一下 /etc/cron.d/dailyjobs 這個設定檔就出現啦~~