|
|
我的maillog需要每天凌晨左右分割和备份,备份的maillog可以不用压缩
我的配置:
coretab中设置分割时间为凌晨一点
logrotate.conf中添加红色的部分:::这一部分是否正确?请各位指点啊!
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 10
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 10}
/var/log/mailog {
daily
size=1M
mail webmaster@jtomron.com
rotate 12
nocompress}
# system-specific logs may be also be configured here.
/var/log/mailog {
daily
size=1M
mail webmaster@jtomron.com
rotate 12
nocompress}
在上面的设置中我添加了以上这些内容,但是发现maillog并不自动分割,好像老是用maillog来备份,于是我改成如下设置
当然以上的设置删除!
vi /etc/logroate.d/sendmail
/var/log/mail {
daily
rotate 12
nocompress
postroate
/bin/kill -HUP `cat /var/run/sendmail.pid 2 > /dev/null `2 /dev/null || true
endscript
}
同时为了让maillog自动在凌晨自动分割而设置了vi /etc/crontab文件
把00 1 * * * run parts /etc/cron.daily
不知道以上设置是否可以达到我的要求呢??各位大大帮忙看看! |
|