现象:
/var/log/messages日志里每1小时报一次错"logrotate: ALERT exited abnormally with [1]"。
排查:
1. 查看/etc/cron.hourly:
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate_hourly.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
应该就是 /usr/sbin/logrotate /etc/logrotate_hourly.conf 这里出错了。
2. 查看了/etc/logrotate_hourly.conf:
/var/log/trace.log {
rotate 10
size 10M
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null`
endscript
}
3. 查看/var/log,没有trace.log文件。
4. touch /var/log/trace.log 问题解决。