#!/bin/bash
dir=/home/bbs-backup/user-login
logdir=/usr/local/apache/logs
year=`date +%Y`
mouth=`date +%m`
day=`date +%d`
mkdir -p $dir/$year/$mouth/$day
cd $logdir
mv access_log $dir/$year/$mouth/$day/access_log.old
mv error_log $dir/$year/$mouth/$day/error_log.old
/usr/local/apache/bin/apachectl graceful
sleep 20
cd $dir/$year/$mouth/$day && gzip access_log.old error_log.old
echo "successful"
阅读(1625) | 评论(0) | 转发(0) |