一 循環(huán)
#!/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
二 預(yù)期輸入
#!/bin/bash
set -x
set -e
ethconsole ${node_path}/nodedata-1/data/geth.ipc <<EOF
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
三 函數(shù)調(diào)用
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}<${new_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
五 根據(jù)日志統(tǒng)計
grep?'2018-09-06?19:1'?appmonitor.log|grep?New?|awk?-F?'"'?'{a+=$8;b+=1}?END?{print?a,b,a/b}'??統(tǒng)計19:10-19:19分,所有上鏈的次數(shù)和平均耗時