请稍侯

nginx日志切分脚本

16 April 2018
更多
#!/bin/bash
#nginx日志切分脚本
#
#nginx 日志存放路径
logs_path='/var/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`