@
besteric 我也没改啥呀,估计就是我运气好吧。
我的代码就是:
```
while [ 1 ] ; do
QOS_Status
echo "Name: $prod_Name, Code: $prod_Code, Time: $rest_Minutes / $total_Minutes, Reset: $remaining_Time"
if [[ "$STATUS"x == "Y"x ]]; then
[ ! -z "$Heart_Qos" ] && QOS_Heart
sleep 55
fi
if [[ "$STATUS"x != "Y"x ]]; then
QOS_Start
sleep 5
fi
done
```
QOS_Status/QOS_Start/QOS_Heart 就是那三个 curl,以及相关结果解析:
```
check_Qos="curl -H 'SessionKey: xx' -H 'Signature: xx' -H 'Date: Wed, 24 Jan 2018 14:16:54 GMT' -H 'Content-Type: text/xml; charset=utf-8' -H 'Host:
api.cloud.189.cn' -H 'User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4)' '
http://api.cloud.189.cn/family/qos/getQosAbilityList.action'"
start_Qos="curl -H 'SessionKey: xx' -H 'Signature: xx' -H 'Date: Wed, 24 Jan 2018 14:18:11 GMT' -H 'Content-Type: text/xml; charset=utf-8' -H 'Host:
api.cloud.189.cn' -H 'User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4)' '
http://api.cloud.189.cn/family/qos/startQos.action?prodCode=76'"
Heart_Qos="curl -H 'SessionKey: xx' -H 'Signature: xx' -H 'Date: Wed, 24 Jan 2018 14:21:13 GMT' -H 'Content-Type: text/xml; charset=utf-8' -H 'Host:
api.cloud.189.cn' -H 'User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4)' '
http://api.cloud.189.cn/family/qos/heartbeatQos.action?qosSn=67150577902955854'"
```
实际运行时 Heart_Qos 中的 qosSn 会被替换成从 start_Qos 的结果中解析出来的值。