Nginx Log文件自动切割

cut_nginx_log.sh:

logs_path="/usr/local/nginx/logs/"
mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +%Y%m%d).log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`

 

然后将cut_nginx_log.sh加入到crontab中,定时在每天0点执行。

posted @ 2012-10-19 17:49  ybtyoyo  阅读(194)  评论(0编辑  收藏  举报