日志切割
1 #定时清除tomcat 日志
01 00 * * * find /srv/tomcat-www/newfeature/logs/ -maxdepth 1 -type f -mtime +2 -exec rm -rf {} \;
2
#每天切割nginx日志
01 00 * * * /bin/bash /srv/nginx/clean_log/clean_log.sh
#!/bin/bash
#Function: cut showone nginx web log
#Author: wang
#Date: 20181024
LOGS_PATH=/srv/nginx/logs
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
mv ${LOGS_PATH}/m.kaisenxue.com/* ${LOGS_PATH}/log_back/m.kaisenxue.com/
mv ${LOGS_PATH}/mob.kaisenxue.com/* ${LOGS_PATH}/log_back/mob.kaisenxue.com/
mv ${LOGS_PATH}/tk.kaisenxue.com/* ${LOGS_PATH}/log_back/tk.kaisenxue.com/
mv ${LOGS_PATH}/www.kaisenxue.com/* ${LOGS_PATH}/log_back/www.kaisenxue.com/
/srv/nginx/sbin/nginx -s reload
find $LOGS_PATH/log_back -maxdepth 1 -type f -mtime +2 -exec rm -rf {} \;
曾经在幽幽暗暗反反复复中追问 才知道平平淡淡从从容容才是真