diff --git a/scripts/health_check.sh b/scripts/health_check.sh index 85322f9..8e466d2 100644 --- a/scripts/health_check.sh +++ b/scripts/health_check.sh @@ -3,7 +3,7 @@ DEFAULT_PATH=/home/ubuntu/uni-sparkle-deploy/uni-sparkle CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1) -TARGET_PORT=8081 +TARGET_PORT=0 if [ ${CURRENT_PORT} -eq "8081" ]; then TARGET_PORT=8082 @@ -18,13 +18,14 @@ echo ">> http://localhost:${TARGET_PORT} 의 상태를 체크합니다" for RETRY_COUNT in 1 2 3 4 5 6 7 8 9 10; do echo ">> ${RETRY_COUNT} trying ..." - RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:${CURRENT_PORT}/status/uni/health) + RESPONSE=$(curl -s http://127.0.0.1:${TARGET_PORT}/status/uni/health) + UP_COUNT=$(echo $RESPONSE | grep 'UP' | wc -l) - if [ ${RESPONSE_CODE} -eq 200 ]; then + if [ ${UP_COUNT} -ge 1 ]; then echo ">> 서비스가 성공적으로 작동 중 입니다" break else - echo ">> ${RESPONSE_CODE}" + echo ">> ${RESPONSE}" fi if [ ${RETRY_COUNT} -eq 10 ]; then echo ">> 서비스가 작동중이지 않습니다" diff --git a/scripts/start.sh b/scripts/start.sh index 5dcef99..e9b7973 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -5,7 +5,7 @@ JAR_NAME=$(ls ${DEFAULT_PATH}/build/libs/ | grep '.jar' | tail -n 1) JAR_PATH=${DEFAULT_PATH}/build/libs/${JAR_NAME} CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1) -TARGET_PORT=8081 +TARGET_PORT=0 echo ">> 현재 nginx의 port = ${CURRENT_PORT}" diff --git a/scripts/stop.sh b/scripts/stop.sh index fcd92ff..31ad62e 100644 --- a/scripts/stop.sh +++ b/scripts/stop.sh @@ -3,7 +3,7 @@ DEFAULT_PATH=/home/ubuntu/uni-sparkle-deploy/uni-sparkle CURRENT_PORT=$(cat /home/ubuntu/service_url.inc | grep -Po '[0-9]+' | tail -1) -TARGET_PORT=8081 +TARGET_PORT=0 echo ">> 현재 nginx의 port = ${CURRENT_PORT}"