linux – 为什么我的CentOS logrotate随机运行?

linux – 为什么我的CentOS logrotate随机运行?,第1张

概述我在/etc/logrotate.d/中放了一个logrotate配置文件,并希望日志在一致的时间旋转;然而,他们没有…记录旋转时间似乎是随机的/ – 一小时. 为什么日志轮换开始时间是随机的,我该如何更改? 信息:我的logrotate配置文件看起来像这样…… /opt/backups/network/*.conf { copytruncate rotate 30 我在/etc/logrotate.d/中放了一个logrotate配置文件,并希望日志在一致的时间旋转;然而,他们没有…记录旋转时间似乎是随机的/ – 一小时.

为什么日志轮换开始时间是随机的,我该如何更改?

信息:我的logrotate配置文件看起来像这样……

/opt/backups/network/*.conf {        copytruncate        rotate 30        daily        create 644 root root        dateext        maxage 30        missingok        notifempty        compress        delaycompress        postrotate            ## Create symbolic links in daily/            PATH=`/usr/bin/dirname `;            file=`/bin/basename `;            /bin/ln -s  $PATH/daily/$file        endscript}
解决方法 关键是知道CentOS从anacron运行/etc/cron.{daily,weekly,monthly}中的脚本… / etc / anacrontab正在设置RANDOM_DELAY,它可以达到预期的效果(它在开始之前延迟到RANDOM_DELAY分钟)工作)…
# /etc/anacrontab: configuration file for anacron# See anacron(8) and anacrontab(5) for details.SHELL=/bin/shPATH=/sbin:/bin:/usr/sbin:/usr/binMAILTO=root# the maximal random delay added to the base delay of the jobsRANDOM_DELAY=45# the jobs will be started during the following hours onlySTART_HOURS_RANGE=3-22#period in days   delay in minutes   job-IDentifIEr   command1       5       cron.daily              nice run-parts /etc/cron.daily7       25      cron.weekly             nice run-parts /etc/cron.weekly@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

设置RANDOM_DELAY = 0 / START_HOURS_RANGE = 3解决了问题…

编辑

经过深思熟虑后,我要删除anacron并安装普通的vixIE cron ……

总结

以上是内存溢出为你收集整理的linux – 为什么我的CentOS logrotate随机运行?全部内容,希望文章能够帮你解决linux – 为什么我的CentOS logrotate随机运行?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/yw/1045117.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存