ngxin日志自动切割脚本

By | 2013 年 1 月 9 日

#!/bin/bash # This script run at 00:00

# The Nginx logs path logs_path="/home/logs/" mkdir -p ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/ mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").log

kill -USR1 `cat /usr/local/webserver/nginx/nginx.pid`

crontab -e

00 3 * * * /bin/bash  /.../nginx/sbin/cut_nginx_log.sh

 

 

 

 

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据