#!/bin/bash # Program:chenglee # Auto cut nginx log script. LOGS_PATH="/usr/local/nginx1.13/logs" TODAY=$(date -d 'today' +%Y-%m-%d) mv ${LOGS_PATH}/access.log ${LOGS_PATH}/access_${TODAY}.log kill -USR1 $(cat /usr/local/nginx1.13/logs/nginx.pid)
chmod a+x cutlog.sh
echo '59 23 * * * root /usr/local/nginx1.13/sbin/cutlog.sh >> /usr/local/nginx1.13/logs/cutnginxlog.log 2>&1' >> /etc/crontab