#!/bin/bash
logfile="test.log"
duration=$((30*60)) # 30分钟,以秒为单位
start_time=$(date +%s)
end_time=$((start_time + duration))
while [[ $(date +%s) -lt $end_time ]]; do
result=$(curl --location 'ip:port/url' \
--header 'Content-Type: application/json' \
--data '{
"p2p_http_request": {
"content": "",
"headers": {
"Content-Type": "application/json",
"target_cluster_id": "xxx"
},
"method": "GET",
"parameters": {},
"url": "url"
},
"peer_id": "xxx",
"port": 29935
}')
# 记录结果和耗时到日志文件
echo -e "$(date +"%Y-%m-%d %H:%M:%S")\n$result\n" >> "$logfile"
sleep 1s
done
串行发送http请求,并记录耗时
Comments 0
Sign in to comment and like
← More postsThat’s all for now. Thanks for reading.
No comments yet.