Chinaunix首页 | 论坛 | 博客
  • 博客访问: 388774
  • 博文数量: 166
  • 博客积分: 1972
  • 博客等级: 上尉
  • 技术积分: 1845
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-19 21:16
文章分类

全部博文(166)

文章存档

2013年(7)

2010年(159)

分类:

2010-10-12 16:04:42

#!/bin/bash

pid=`cat /usr/local/coreseek/var/log/searchd.pid`
echo " `date` coreseek's pid is $pid " >> coreseek.log
kill -9 $pid
cd /usr/local/coreseek/var/log/
mv query.log query.log.`date +%m%d_%Y -d '-1 day'`
sleep 5
/usr/local/coreseek/bin/searchd
cd /root/script
newpid=`cat /usr/local/coreseek/var/log/searchd.pid`
echo " `date` coreseek's new pid is $newpid " >> coreseek.log


#cd /root/script
zt=`date +%m%d_%Y -d '-1 day' `
zs=` cat /usr/local/coreseek/var/log/query.log.$zt | awk -F ' ' '{print $6}' | wc -l `
a=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.1) print $0}'  |wc -l `
b=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.2) print $0}'  |wc -l `
c=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.3) print $0}'  |wc -l `

d=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.15) print $0}'  |wc -l `
e=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.25) print $0}'  |wc -l `
f=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.35) print $0}'  |wc -l `

a1=` gawk -v x=$a -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
#百分比处理。
b1=` gawk -v x=$b -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
c1=` gawk -v x=$c -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `

d1=` gawk -v x=$d -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
e1=` gawk -v x=$e -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
f1=` gawk -v x=$f -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `

echo "coreseek's  low query  Percentage" >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.1s' Percentage $a1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.15s' Percentage $d1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.2s' Percentage $b1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.25s' Percentage $e1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.3s' Percentage $c1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.35s' Percentage $f1 >> coreseek.log

阅读(447) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~