一 循环
#!/bin/bash
mv perf.log perf.log_bak
while (( "1"=="1" ))
do
java -cp 'conf/:apps/*:lib/*' org.bcos.channel.test.db.PerfomanceOk trans 50000 100 >> perf.log
sleep 550
done
二 预期输入
#!/bin/bash
set -x
set -e
ethconsole ${node_path}/nodedata-1/data/geth.ipc <
web3.admin.getPeers(console.log);web3.eth.getBlock(2,console.log)
EOF
/usr/bin/expect << EOF
set timeout 500
spawn ./install_node.sh install
expect "gavin:"
send "Aa12345!\r"
expect "Installing eth environment success"
EOF
三 函数调用
running(){
sleep 1
old_count=`grep +++++ ${host_path}/build/nodedir$1/log/info*|wc -l`
sleep 7
new_count=`grep +++++ ${host_path}/build/nodedir$1/log/info*|wc -l`
if((${old_count}
then
echo "****** success, node$1 is running normally ******"
#return true
else
echo "****** fail,node$1 is not running ******"
#return false
fi
}
running 3
四 curl命令借口测试
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":83}' 127.0.0.1:8545
curl -s -l -H "Content-type: application/json" -X POST -d '{"seqNo":"1067","orgNo":"123","chainId":"100120043","chainName":"he43","chainContent":"test43","extId":"ex43"}'http://10.107.105.143:9000/api/chain/new
五 根据日志统计
grep '2018-09-06 19:1' appmonitor.log|grep New |awk -F '"' '{a+=$8;b+=1} END {print a,b,a/b}' 统计19:10-19:19分,所有上链的次数和平均耗时