我使用以下sed命令来追加行:
rotate 1
size 1k
在missok这个词之后
小美学问题是“旋转1”不像其他线那样对齐
# sed '/missingok/a rotate 1\n size 1k' /etc/logrotate.d/httpd
/var/log/httpd/*log {
missingok
rotate 1
size 1k
notifempty
sharedscripts
delaycompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
有人建议如何在missingok字符串下缩进字符串“rotate 1”?
原始文件
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
解决方法:
显然,第一批追逐者必须逃脱
sed '/missingok/a\\trotate 1\n\tsize 1k' /etc/logrotate.d/httpd