I use the following sed command in order to append the lines:
rotate 1
size 1k
after the word missingok
the little esthetic problem is that "rotate 1" isn’t alignment like the other lines
# 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
}
someone have advice how to indent the string "rotate 1" under missingok string ?
the original file
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
Apparently the first sequence of characers has to be escaped
sed '/missingok/a\\trotate 1\n\tsize 1k' /etc/logrotate.d/httpd