curl测试api接口状态

#!/bin/bash
#根据测试背景填写连接超时时长,单位秒
ct=5
#根据测试背景填写响应最大时长,单位秒
cm=5
#根据测试背景填写URL
#uri1=“http://10.10.160.23/nedy/123_init”
#uri2=“http://10.10.160.24/sso/345_list” #
SERVERHOST=“10.10.160.23 10.10.160.24”

#查看API状态
for i in S E R V E R H O S T d o r e s p 1 = ‘ c u r l − I − s − − c o n n e c t − t i m e o u t " SERVERHOST do resp1=`curl -I -s --connect-timeout " SERVERHOSTdoresp1=curlIsconnecttimeout"ct" -m “ c m " − w " cm" -w "%{http_code}" -o /dev/null http://" cm"w"i”/nedy/123_initt resp2=curl -I -s --connect-timeout “ c t " − m " ct" -m " ct"m"cm” -w “%{http_code}” -o /dev/null http://“$i”/sso/345_list`
if [ r e s p 1 = = 200 ] ; t h e n e c h o " resp1 == 200 ] ; then echo " resp1==200];thenecho"i ===API01 status 200 ok"
else
echo “$i ===API01 status faild”
fi

#查看API状态
if [ r e s p 2 = = 200 ] ; t h e n e c h o " resp2 == 200 ] ; then echo " resp2==200];thenecho"i ===API01 status 200 ok"
else
echo “$i ===API02 status faild”
fi
done

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值