From 1e67a5e932e139e23a72ad144627788ddebce843 Mon Sep 17 00:00:00 2001 From: pushedrumex Date: Tue, 13 Aug 2024 17:56:49 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=ED=94=84=EB=A1=9C=EC=84=B8=EC=8A=A4?= =?UTF-8?q?=20=EC=A2=85=EB=A3=8C=20=EC=8B=A4=ED=8C=A8=20=EC=8B=9C,=20?= =?UTF-8?q?=EB=B0=B0=ED=8F=AC=20=EC=A2=85=EB=A3=8C=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy.sh | 9 +++++++-- scripts/kill.sh | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 9b9edf0..63e5211 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -10,7 +10,7 @@ APP_LOG=$DEPLOY_PATH/application.log ERROR_LOG=$DEPLOY_PATH/deploy-error.log DEPLOY_LOG=$DEPLOY_PATH/deploy.log -echo "\n[ $(date +%c) ] 배포 시작" >> $DEPLOY_LOG +echo "[ $(date +%c) ] 배포 시작" >> $DEPLOY_LOG echo "[ $(date +%c) ] Build 파일 복사" >> $DEPLOY_LOG cp $PROJECT_ROOT/$PROJECT_NAME/build/libs/*.jar $DEPLOY_PATH/ @@ -43,12 +43,17 @@ else sudo sh $SCRIPT_PATH/kill.sh $IDLE_PORT fi +if [ $? -ne 0 ]; then + echo "[ $(date +%c) ] 새 어플리케이션을 배포하지 않고 종료" >> $DEPLOY_LOG + exit 1 +fi + echo "[ $(date +%c) ] 새 어플리케이션 배포" >> $DEPLOY_LOG JAR_NAME=$(ls -tr "$DEPLOY_PATH" | grep jar | tail -n 1) echo "[ $(date +%c) ] JAR Name: $JAR_NAME" >> $DEPLOY_LOG -nohup java -jar $DEPLOY_PATH/"$JAR_NAME" --spring.profiles.active=$IDLE_PROFILE > $APP_LOG 2> $ERROR_LOG & +nohup java -jar $DEPLOY_PATH/"$JAR_NAME" --spring.profiles.active=$IDLE_PROFILE >> $APP_LOG 2>> $ERROR_LOG & echo "[ $(date +%c) ] $IDLE_PROFILE 10초 후 Health check 시작" >> $DEPLOY_LOG sleep 10 diff --git a/scripts/kill.sh b/scripts/kill.sh index 45b48e8..427fd7a 100644 --- a/scripts/kill.sh +++ b/scripts/kill.sh @@ -21,7 +21,6 @@ do if [ $retry_count -eq 10 ] then echo "[ $(date +%c) ] $IDLE_PORT kill 실패." >> $DEPLOY_LOG - echo "[ $(date +%c) ] 새 어플리케이션을 배포하지 않고 종료" >> $DEPLOY_LOG exit 1 fi