我已经在名为custom的Ubuntu服务器上配置了/etc/logrotation.d/custom目录中的日志旋转,条目如下所示
/var/log/apache2/access.log {
daily
mailfirst tarun@example.com
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}但是,当我运行命令logrotate -f /etc/logrotate.d/custom时,它会出现以下错误。
logrotate -f custom
error: custom:3 unexpected text它给出了行mailfirst tarun@example.com的错误。为什么?请帮帮忙。
发布于 2013-11-12 14:02:52
它应该是:
var/log/apache2/access.log {
daily
mail tarun@example.com
mailfirst
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}https://serverfault.com/questions/554418
复制相似问题