forked from YAPP-16th/Team_Web_2_Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
32 lines (25 loc) · 897 Bytes
/
Copy pathstart.sh
File metadata and controls
32 lines (25 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
BUILD_PATH=$(ls /home/ec2-user/build/*.jar)
JAR_NAME=$(basename "$BUILD_PATH")
echo "> build 파일명: $JAR_NAME"
echo "> build 파일 복사"
DEPLOY_PATH=/home/ec2-user/
cp "$BUILD_PATH" $DEPLOY_PATH
echo "> springboot-deploy.jar 교체"
CP_JAR_PATH=$DEPLOY_PATH$JAR_NAME
APPLICATION_JAR_NAME=springboot-deploy.jar
APPLICATION_JAR=$DEPLOY_PATH$APPLICATION_JAR_NAME
ln -Tfs "$CP_JAR_PATH" $APPLICATION_JAR
echo "> 현재 실행중인 애플리케이션 pid 확인"
CURRENT_PID=$(pgrep -f $APPLICATION_JAR_NAME)
if [ -z "$CURRENT_PID" ]
then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다."
else
echo "> kill -15 $CURRENT_PID"
kill -15 "$CURRENT_PID"
sleep 5
fi
source ~/.bash_profile
echo "> $APPLICATION_JAR 배포"
nohup java -jar $APPLICATION_JAR --spring.profiles.active=logging-info > /dev/null 2> /dev/null < /dev/null &