Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2020690
  • 博文数量: 593
  • 博客积分: 20034
  • 博客等级: 上将
  • 技术积分: 6779
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-06 14:07
文章分类

全部博文(593)

文章存档

2016年(1)

2011年(101)

2010年(80)

2009年(10)

2008年(102)

2007年(16)

2006年(283)

我的朋友

分类: LINUX

2010-08-13 00:19:20

#!/usr/bin/ksh
banner http://netyu.cublog.cn

if [ $# -ne 2 ] ; then
  echo Usage : count.sh  parameter1 parameter2 .
  echo parameter1 means application name in cs.sh script .
  echo parameter2 means the period\(minutes\)
  echo example:  speed_est.sh saledb 2
  echo this means to estimat the pprc speed of saledb in 2 minutes
  exit 1
fi
 
CS_DIR=/opt/ibm/scripts
LSPPRC_PS=lspprc_PS
EXECUTE_CS=--production

if [ ! -e $CS_DIR/cs.sh ] ; then
  echo Cannot find cs.sh , please edit this file to redefine the cs.sh directory .
  exit 1
fi

if  [  ` $CS_DIR/cs.sh $EXECUTE_CS $1 $LSPPRC_PS |grep 'no DSCLI commands found for'  |wc -l ` -gt 0 ] ; then
  echo cs.sh cannot execute , please check it !
else
  result1=0
  a=`$CS_DIR/cs.sh -production $1  $LSPPRC_PS |grep , |grep -v Date |grep -v ID |grep -v Full |awk -F, '{print $5}'`
  for i in $a
  do
  result1=`expr $result1 + $i`
  done
  if [ $result1 -eq 0 ] ; then
    echo PPRC of $1 has been finished or no data is modified ,speed estimation is terminated !
    exit 1
  else
    sec=`expr $2 \* 60 `
    echo  Please wait for $sec\(seconds\) ...
     sleep $sec
     result2=0
     a=`$CS_DIR/cs.sh $EXECUTE_CS $1  $LSPPRC_PS |grep , |grep -v Date |grep -v ID |grep -v Full |awk -F, '{print $5}'`
     for i in $a
     do
       result2=`expr $result2 + $i`
      done
      if [ $result2 -ge $result1 ] ; then   
        echo PPRC of $1 is not started or data of being modified is more than that of being transfered , speed estimation is terminated !
        exit 1
      fi
      if [ $result2 -eq 0 ] ; then
         echo $1 has been finished in the period ,speed estimation is not quiet correctly  !
         speed=`echo \($result1 - $result2\)*64/1024/$sec|bc `
         echo pprc speed is $speed\(m\)\/sec
      else
         speed=`echo \($result1 - $result2\)*64/1024/$sec|bc `
         remain=`echo $result2*64/1024/1024 |bc `
         alltime=`echo $result2*64/1024/$speed | bc `
         echo $1 still has $remain\(G\) to be finished and the speed is $speed\(m\)\/second and it will be finished in $alltime\(seconds\) . 
      fi
   fi
fi

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