/var/log/apache2/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if invoke-rc.d apache2 status > /dev/null 2>&1; then \
invoke-rc.d apache2 reload > /dev/null 2>&1; \
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
postrotate
prerotate
지정된 로그파일에 logrotate작업이 끝나고 난 이후에 실행할 작업을 설정해둔 것이다.
대부분 이부분에 설정되는 작업은 rotate된 로그파일의 데몬을 재시작시키는 작업이다.
반대의 작업을 하려면 즉, logrotate작업 전에 실행할 작업이 있다면
postrotate/endscript대신에 prerotate/endscript를 사용하면 된다.
invoke-rc.d : service 와 비슷한 데몬패키지 관리 명령어
http://manpages.ubuntu.com/manpages/trusty/man8/invoke-rc.d.8.html invoke-rc.d is a generic interface to execute System V style init script /etc/init.d/name
actions, obeying runlevel constraints as well as any local policies set by the system
administrator.
All access to the init scripts by Debian packages' maintainer scripts should be done
through invoke-rc.d.
This manpage documents only the usage and behavior of invoke-rc.d. For a discussion of
the System V style init script arrangements please see init(8). More information on
invoke-rc.d can be found in the section on runlevels and init.d scripts of the Debian
Policy Manual.