/etc/logrotate.d/httpd

/etc/logratate.d/httpd

1 예시 1[ | ]

Bash
Copy
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

2 예시 2[ | ]

Bash
Copy
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/httpd/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

3 지시어 설명[ | ]

  • missingok: 로그파일이 없어도 오류메시지 없이 넘어감
  • notifempty: 로그파일 내용이 비었으면 로테이트하지 않음
  • sharedscripts: 로그파일이 여러개 있어도(*log) 스크립트는 공유됨(즉, 한번만 수행)
  • postrotate:로테이트 후 스크립트(명령어) 수행

4 같이 보기[ | ]