#!/bin/bash

# 就绪检查， 返回0表示就绪

# 请求tech/health/check
# status 返回5xx or 000  启动中(未就绪)
#        返回404 未实现该接口，认为就绪
#        返回2xx， 就绪
#        其他， 就绪

statusCode=`curl -I  -o /dev/null -s -w %{http_code} http://localhost/tech/health/check`
echo "statusCode: ${statusCode}"

statusCodeFirst="${statusCode:0:1}"
echo "statusCodeFirst: ${statusCodeFirst}"

READY=0
UNREADY=1

if [ ${statusCodeFirst} = "5" -o ${statusCodeFirst} = "0" ]
then
  exit ${UNREADY}
fi

exit ${READY}


