0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#!/bin/bash # Author:Byrd # Version:0.1 # Site:note.t4x.org # Contact:root#t4x.org File="/usr/local/nginx/logs/access.log" sum=0 exec < 1.tzt while read line do [ -z "`echo $line | awk '{print $10}' | sed 's#[0-9]##g'`" ] || continue ((sum=sum+`echo $line|awk '{print $10}'`)) done echo count num is :$(($sum/1024/1024)) |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#!/bin/bash # Author:Byrd # Version:0.1 # Site:note.t4x.org # Contact:root#t4x.org LOGS_DIR=/var/log/nginx/ YESTERDAY=$(date -d "yesterday" +%Y-%m-%d) #cut logs mv ${LOGS_DIR}/json.log ${LOGS_DIR}/json_${YESTERDAY}.log #RELOAD NGINX kill -USR1 `ps axu | grep "nginx: master process" | grep -v grep | awk '{print $2}'` #7 days #cd ${LOGS_PATH} #find . -mtime +7 -name "*20[1-9][3-9]*" | xargs rm -f #exit 0 |
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!