#!/bin/bash # LOGS_PATH=/opt/nginx/logs YESTERDAY=$(date -d "yesterday" +%Y-%m-%d) mv -f ${LOGS_PATH}/web项目名.access.log ${LOGS_PATH}/web项目名.access_${YESTERDAY}.log mv -f ${LOGS_PATH}/error.log ${LOGS_PATH}/error_${YESTERDAY}.log kill -s USR1 `cat /opt/nginx/logs/nginx.pid`
原文:http://icekina.blog.51cto.com/5911953/1726848