-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
REPOSITORY=/home/ec2-user/app/ | ||
PROJECT_NAME=19th-lazy-backend | ||
EC2_HOST_NAME=lazy-yj | ||
|
||
cd $REPOSITORY/$PROJECT_NAME/ | ||
|
||
echo "> Git Pull" | ||
|
||
git pull | ||
|
||
echo "> 프로젝트 Build 시작" | ||
|
||
./gradlew build | ||
|
||
echo "> LAZY Project 디렉토리로 이동" | ||
|
||
cd $REPOSITORY | ||
|
||
echo "> Build 파일 복사" | ||
|
||
cp $REPOSITORY/$PROJECT_NAME/api/build/libs/*.jar $REPOSITORY/ | ||
|
||
echo "> 현재 구동중인 애플리케이션 pid 확인" | ||
|
||
CURRENT_PID=$(pgrep -f ${EC2_HOST_NAME}) | ||
|
||
echo "현재 구동 중인 애플리케이션 pid : $CURRENT_PID" | ||
|
||
if [ -z "$CURRENT_PID" ]; then | ||
echo "> 현재 구동 중인 애플리케이션이 없으므로 종료하지 않습니다." | ||
else | ||
echo "> kill -15 $CURRENT_PID" | ||
sudo kill -15 $CURRENT_PID | ||
sleep 5 | ||
fi | ||
|
||
echo "> 새 애플리케이션 배포" | ||
|
||
JAR_NAME=$(ls -tr $REPOSITORY/ | grep jar | tail -n 1) | ||
|
||
echo "> JAR Name: $JAR_NAME" | ||
|
||
nohup java -jar $REPOSITORY/$JAR_NAME & |