lcfs/tools/healthCheck.sh

21 lines
628 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env bash
# 检测n次每次停顿1秒100差不多要是起不来八成是挂了
echo "用法: sh healthCheck.sh 100"
for ((i=1; i<=$1; i++));
do
echo "健康检查:$i"
busi=$(curl -sI http://localhost:8183/busi/payorcers/contract/get?id=|grep "HTTP/1.1 200")
user=$(curl -sI http://localhost:8182/department/childrenList?username= |grep "HTTP/1.1 200")
gate=$(curl -sI http://localhost:8181/user/department/childrenList?username= |grep "HTTP/1.1 200")
if [[ -n $busi ]] && [[ -n $user ]] && [[ -n $gate ]];
then
echo "👍检测通过🐮"
exit 0
else
sleep 1
fi
done
echo "超时啦~"
exit -1