20111128_Nginx日志轮转_shell

#!/bin/bash
log_path="/home/wwwlogs/"
mkdir -p ${log_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/
mv ${log_path}access.log ${log_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").log
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`

________________________________
crontab -e
0 0 * * * /usr/local/nginx/sbin/cut_nginx_log.sh

你可能感兴趣的:(nginx,职场,休闲)