Nginx日志清理

#!/bin/bash
log_dir="/Data/log"
time=`date +%Y%m%d`  
/bin/mv  ${log_dir}/nginx-access.log ${log_dir}/nginx-access.$time.log
kill -USR1 `cat  /var/run/nginx.pid`

 

Log Rotation

nginx will re-open it's logs in response to the USR1 signal.

$ mv access.log access.log.0
$ kill -USR1 cat master.nginx.pid
$ sleep 1
$ gzip access.log.0    # do something with access.log.0
可以按照日期来切割保存日志

已有 0 人发表留言,猛击->>这里<<-参与讨论


JavaEye推荐
  • —软件人才免语言低担保 赴美带薪读研!—



你可能感兴趣的:(Nginx日志清理)