nginx日志自动切割

#!/bin/bash
log_file=/home/wwwlogs/access.log
log_new_file=/home/wwwlogs/$(date -d "yesterday" +"%Y_%m_%d")
log_last_week=/home/wwwlogs/$(date -d last-week +%Y_%m_%d)
mv $log_file $log_new_file
/usr/local/nginx/sbin/nginx -s reload
rm -f $log_last_week
exit 0

你可能感兴趣的:(nginx,日志)