Skip to content

Commit

Permalink
Merge pull request #18 from Tune-Fun/habinkim-deploy-patch
Browse files Browse the repository at this point in the history
Create deploy.sh
  • Loading branch information
habinkim authored Mar 1, 2024
2 parents b32b2b0 + 515a2ba commit c16665b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
BUILD_JAR=$(ls /home/habin/action/build/libs/*.jar)
JAR_NAME=$(basename $BUILD_JAR)
echo "> build 파일명: $JAR_NAME" >> /home/habin/action/deploy.log

echo "> build 파일 복사" >> /home/habin/action/deploy.log
DEPLOY_PATH=/home/habin/action/
cp $BUILD_JAR $DEPLOY_PATH

echo "> 현재 실행중인 애플리케이션 pid 확인" >> /home/habin/action/deploy.log
CURRENT_PID=$(pgrep -f $JAR_NAME)

if [ -z $CURRENT_PID ]
then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." >> /home/habin/action/deploy.log
else
echo "> kill -15 $CURRENT_PID"
kill -15 $CURRENT_PID
sleep 5
fi

DEPLOY_JAR=$DEPLOY_PATH$JAR_NAME
echo "> DEPLOY_JAR 배포" >> /home/habin/action/deploy.log
nohup java -jar $DEPLOY_JAR --spring.profiles.active=dev >> /home/habin/deploy.log 2>/home/habin/action/deploy_err.log &

0 comments on commit c16665b

Please sign in to comment.