mkdir -p /usr/local/script
vi cut_del_logs.sh
#!/bin/bash
LOGS_PATH=/home/wwwlogs/default.gz
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
mv ${LOGS_PATH}/access.gz ${LOGS_PATH}/access_${YESTERDAY}.gz
kill -USR1 `ps axu | grep "nginx: master process" | grep -v grep | awk '{print $2}'`
#kill USR1 指告诉应用程序重载配置文件相当于reload
cd ${LOGS_PATH}
find . -mtime +7 -name "*20[1-9][3-9]*" | xargs rm -f
exit 0
crontab -e
1 0 * * * /usr/local/script/cut_del_logs.sh
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
文章评论 本文章有个评论