Stuff
public text v1 · immutable#!/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