Skip to content

Commit

Permalink
chore/#29: 배포 스트립트 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
pushedrumex committed Feb 22, 2024
1 parent 57cd23b commit 93057ab
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@ DEPLOY_LOG=$DEPLOY_PATH/deploy.log

mkdir $DEPLOY_PATH

echo "✅ Build 파일 복사" >> $DEPLOY_LOG
echo "------------------------------------------------------------------------------------" >> $DEPLOY_LOG

echo "[ $(date +%c) ] Build 파일 복사" >> $DEPLOY_LOG
cp $PROJECT_ROOT/$PROJECT_NAME/build/libs/*.jar $DEPLOY_PATH/

echo " 현재 구동 중인 애플리케이션 pid 확인" >> $DEPLOY_LOG
CURRENT_PID=$(pgrep -f $APPLICATION_NAME.*.jar)
echo "[ $(date +%c) ] 현재 구동 중인 애플리케이션 pid 확인" >> $DEPLOY_LOG
CURRENT_PID=$(pgrep -f $APPLICATION_NAME)

echo " 현재 구동 중인 애플리케이션 pid: $CURRENT_PID" >> $DEPLOY_LOG
echo "[ $(date +%c) ] 현재 구동 중인 애플리케이션 pid: $CURRENT_PID" >> $DEPLOY_LOG
if [ -z "$CURRENT_PID" ]; then
echo " 현재 구동 중인 애플리케이션이 없으므로 종료하지 않습니다." >> $DEPLOY_LOG
echo "[ $(date +%c) ] 현재 구동 중인 애플리케이션이 없으므로 종료하지 않습니다." >> $DEPLOY_LOG
else
echo " kill -15 $CURRENT_PID" >> $DEPLOY_LOG
echo "[ $(date +%c) ] kill -15 $CURRENT_PID" >> $DEPLOY_LOG
kill -15 "$CURRENT_PID"
sleep 5
fi

echo " 새 어플리케이션 배포" >> $DEPLOY_LOG
echo "[ $(date +%c) ] 새 어플리케이션 배포" >> $DEPLOY_LOG

JAR_NAME=$(ls -tr "$DEPLOY_PATH" | grep jar | tail -n 1)

echo " JAR Name: $JAR_NAME" >> $DEPLOY_LOG
nohup java -jar $DEPLOY_PATH/$JAR_NAME --spring.profiles.active=dev > $APP_LOG 2> $ERROR_LOG &
echo "[ $(date +%c) ] JAR Name: $JAR_NAME" >> $DEPLOY_LOG
nohup java -jar $DEPLOY_PATH/"$JAR_NAME" --spring.profiles.active=dev > $APP_LOG 2> $ERROR_LOG &

0 comments on commit 93057ab

Please sign in to comment.