首页 | 新闻 | 交流 | 问吧 | 文档 | 手册 | 下载 | 博客

apache graceful重启

作者:  时间: 2010-12-02
#!/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"