接口监控脚本

loginservice.sh
[msdk@10-4-14-148 ~]$ more loginservice.sh 
#!/bin/bash


gameid="100"
gamekey="987654321"
sdkkey="12345678"
username="testname"
password="testpass"
ostype="1"
timestamp="20141029052325"
sign=$(echo -n $gameid$gamekey$username$timestamp$sdkkey|md5sum|cut -c1-32)
postdata="gameid="$gameid"&gamekey="$gamekey"&username="$username"&password="$password"&ostype="$ostype"&timestamp="$timestamp"&sign="$sign
posturl="https://120.132.xx.xx/sdkserver/loginservice"



retcode=$(curl --connect-timeout 3 -m 3 -s -k -d $postdata $posturl)
findcode=$(echo $retcode | grep errcode\":\"0\")
if [ "$findcode" = "" ];then
     echo "send warn message!:"
 else
     echo "this server is ok!"
fi

 

你可能感兴趣的:(脚本)