All pastes #91538 Raw Edit

Stuff

public text v1 · immutable
#91538 ·published 2006-07-18 18:23 UTC
rendered paste body
#!/bin/bash
#http log rotation dor apache2 on RH

alias rm=rm
suffix=`hostname`-`date +%Y%m%d`
LOGDIR=/usr/local/apache2/logs

echo "Starting HTTP rotation `date +%Y%m%d`"
if [ -e ${LOGDIR}/access_log ]; then
        cd ${LOGDIR}
        mv access_log access_log.`hostname`-`date +%Y%m%d`
        mv error_log error_log.`hostname`-`date +%Y%m%d`
else
        echo "access_log is not found" >> /var/log/messages
fi

if [ -f ${LOGDIR}/*-access_log ]; then
        cd ${LOGDIR}
        mv *-access_log