Created
September 22, 2015 11:39
-
-
Save yangl/273cdea87aa31583b55e to your computer and use it in GitHub Desktop.
定时切割删除日志
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
log_dir="/data/metricslog" | |
date_dir=`date +%Y-%m-%d --date='yesterday'` | |
cd $log_dir | |
while read line | |
do | |
mv ./nginx/$line/metrics.access.log ./nginx/$line/metrics.access.log-$date_dir | |
done<$log_dir/loglist.txt | |
/data/soft/nginx/sbin/nginx -s reload | |
find $log_dir -type f -name "*.log*" -mtime +7 -exec rm -rf {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
das | |
asm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment