#!/bin/sh # This script cycles the access log files, keeping four # versions handy, while compressing the oldest. Only two # copies of the error log are kept. # See "Web Security, A Step-by-Step Reference Guide" by Lincoln Stein, page 194 cd /usr/local/etc/httpd/logs /bin/gzip -c access_log.4 >> old_logs.gz mv -f access_log.3 access_log.4 mv -f access_log.2 access_log.3 mv -f access_log.1 access_log.2 mv -f access_log access_log.1 mv -f error_log.1 error_log.2 mv -f error_log error_log.1 kill -HUP `cat httpd.pid` sleep 3 chgrp webmaster access_log chmod 0640 access_log chmod 0640 old_logs.gz