Skip to content

Commit

Permalink
feat: 배포 스크립트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamiwood committed Dec 19, 2024
1 parent 72e19b3 commit dc50ad9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

DEPLOY_PATH=/home/ubuntu/itcast
echo ">>> 배포 경로: $DEPLOY_PATH" >> /home/ubuntu/deploy.log

mkdir -p $DEPLOY_PATH
echo ">>> 디렉토리 생성 완료" >> /home/ubuntu/deploy.log

BUILD_JAR=$(ls /home/ubuntu/itcast/build/libs/*.jar)
JAR_NAME=$(basename $BUILD_JAR)
echo ">>> build 파일명: $JAR_NAME" >> /home/ubuntu/deploy.log

echo ">>> build 파일 복사" >> /home/ubuntu/deploy.log
cp $BUILD_JAR $DEPLOY_PATH 2>> /home/ubuntu/deploy_err.log

echo ">>> 현재 실행중인 애플리케이션 pid 확인 후 일괄 종료" >> /home/ubuntu/deploy.log
sudo ps -ef | grep java | awk '{print $2}' | xargs kill -15 2>> /home/ubuntu/deploy_err.log

DEPLOY_JAR=$DEPLOY_PATH/$JAR_NAME
echo ">>> DEPLOY_JAR 배포" >> /home/ubuntu/deploy.log
echo ">>> $DEPLOY_JAR$JAR_NAME를 실행합니다" >> /home/ubuntu/deploy.log
nohup java -jar -Dspring.profiles.active=prod $DEPLOY_JAR >> /home/ubuntu/deploy.log 2>> /home/ubuntu/deploy_err.log &

0 comments on commit dc50ad9

Please sign in to comment.