Linux下定时分割Nginx日志

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/bash
#

#Nginx Log 存放的路径Path
logs_path="/data1/logs/"

mkdir -p ${logs_path}$(date -d "%Y")/$(date -d "%m")/
mv ${logs_path}access.log ${logs_path}$(date -d "%Y")/$(date -d "%m")/access_$(date -d "%Y%m%d").log
kill -USR1 'cat /usr/local/nginx/nginx.pid'