#vi cut_log.sh
#!/bin/sh
logs_path="/data/log/nginx/"
date_dir=${logs_path}$(date -v "-1d" +"%Y%m")/$(date -v "-1d" +"%d")/
mkdir -p $date_dir
mv ${logs_path}access.log $date_dir
/usr/local/sbin/nginx -s reopen
#chmod +x cut_log.sh
加入到crontab 每天0点执行。