标签:
#!/bin/bash #desc: cut nginx log #this script run at 00:00 LOG_PATH=‘/usr/local/nginx/logs/‘; LOG_BACK_PATH=‘/home/www/log/‘$(date -d ‘-1 days‘ +‘%Y/%m/‘); mkdir -p $LOG_BACK_PATH; cd $LOG_PATH && gzip access.log mv access.log.gz $LOG_BACK_PATH‘access_‘$(date +‘%d‘)‘.log.gz‘; kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`;
crontab -e
0 0 * * * /bin/bash /bin/bash /root/tools/crond/nginxlog.sh 1>/dev/null 2>&1
标签:
原文地址:http://www.cnblogs.com/bai-jimmy/p/4190810.html