nginx切割日志

Posted on Posted in nginx
Tips: 本文创建于2015年11月4日,已超过 2 年,内容或图片可能已经失效!

1、nginx平滑启动

  1. kill -HUP `cat /opt/nginx/logs/nginx.pid`  

2、nginx日志切割脚本

  1. #!/bin/bash  
  2. # Author: liuhonghe   
  3.   
  4. DATE=$(date -d "today" +"%Y%m%d")  
  5. nglogs='/usr/local/nginx/logs'  
  6.   
  7. mkdir -p $nglogs/access-error/$DATE  
  8. mv $nglogs/access.log $nglogs/access-error/${DATE}/${DATE}_access.log  
  9. mv $nglogs/error.log $nglogs/access-error/${DATE}/${DATE}_error.log  
  10. kill -USR1 `cat $nglogs/nginx.pid`  
» 转载请注明来源:若我若鱼 » nginx切割日志

Leave a Reply

Your email address will not be published. Required fields are marked *

18 − 13 =