标签:
每天凌晨运行切割日志的shell脚本
10 00* * * /bin/bash /usr/local/nginx/sbin/cut_nginx_log.sh
脚本如下
#!/bin/bash
# #This script run at 00:10
## The Nginx logs path
logs_path="/usr/local/nginx/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/nginx/nginx.pid`
标签:
原文地址:http://blog.csdn.net/u011579204/article/details/46005739