Entries Tagged as 'logrotate'

logrotate的一个诡异问题

今天听说有台机器的某些log没有被正确rotate
我就上去看
发现配置并没有问题呀
于是看log
/var/log/cron
看到cron.daily还是定时跑了的
再看
/var/spool/mail/root
发现错误提示了:

/etc/cron.daily/logrotate:

error: bad year 1991 for file /var/account/pacct in state file /var/lib/logrotate.status

ls -l /var/account/pacct

-rw——- 1 root root 83996800 Feb 14 17:25 /var/account/pacct
这个时间戳没有问题
再看文件/var/lib/logrotate.satus
发现

“/var/account/pacct” 1991-4-14

把这一行删掉
再跑logrotate
logrotate -f /etc/logrotate.conf
还是报另外一个文件的时间”年”1991有问题
再编辑/var/lib/logrotate.status文件
把所有1991年的都删掉
再重新跑logrotate
这个世界终于安静了
:)
不明白,一点都没搞明白到底是为什么

cron的配置跑了2份!

前两天碰到个问题
某2台机器上某个log的logrotate总不对
上去看了看
一台fc3(fedora core 3)、一台RedHat9(够有年头了吧)
具体现象是xxxlog.1的大小为0,但是xxxlog.2倒是正常
而且时间正好是上一次做rotate的时间
再看了看/var/spool/mail/root和/var/log/cron
初步断定是xxxlog的logrotate跑了两遍导致的
但是哪里导致cron跑了2份呢

最后发现
crontab -l里有东西
而且跟/etc/crontab里的内容一样!
用crontab -e把里面的东西删掉
第二天早上log就正常了