# nginx日志分割脚本
访问量增多log日志文件过大,需要切割日志
#!/bin/bash
savepath_log='/app/nginx/logs_back'
nglogs='/app/nginx/logs'
mkdir -p $savepath_log/$(date +%Y)/$(date +%m)
mv $nglogs/game.access.log $savepath_log/$(date +%Y)/$(date +%m)/game.access.$(date +%Y%m%d).log
mv $nglogs/www.access.log $savepath_log/$(date +%Y)/$(date +%m)/www.access.$(date +%Y%m%d).log
mv $nglogs/news.access.log $savepath_log/$(date +%Y)/$(date +%m)/news.access.$(date +%Y%m%d).log
mv $nglogs/bbs.access.log $savepath_log/$(date +%Y)/$(date +%m)/bbs.access.$(date +%Y%m%d).log
mv $nglogs/user.access.log $savepath_log/$(date +%Y)/$(date +%m)/user.access.$(date +%Y%m%d).log
kill -USR1 `cat $nglogs/nginx.pid
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10