自动分割LOG 的nginx_log.sh 文件
*************
nginx_app=/usr/local/nginx/sbin/nginx
logs_dir=/home/www/logs/
bak_dir=/home/www/logs/bak/
echo "moving logs"
/bin/mv /usr/local/nginx/logs/access.log $bak_dir/`date +%Y%m%d`_access.log
/bin/mv /home/www/logs/nginx_error.log $bak_dir/`date +%Y%m%d`_nginx_error.log
sleep 5
echo "$nginx_app -s reopen"
$nginx_app -s reopen
cd $bak_dir
/bin/tar -zcvf log_`date +%Y%m%d`.tar.gz *.log
kill -HUP `cat /usr/local/nginx/nginx.pid`
0 0 * * * sh /root/nginx_log.sh