File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ ROOT_PATH=" /home/ec2-user/Leets/LEETS"
4
+ JAR=" $ROOT_PATH /application.jar"
5
+
6
+ APP_LOG=" $ROOT_PATH /application.log"
7
+ ERROR_LOG=" $ROOT_PATH /error.log"
8
+ START_LOG=" $ROOT_PATH /start.log"
9
+
10
+ NOW=$( date +%c)
11
+
12
+ echo " [$NOW ] $JAR 복사" >> $START_LOG
13
+ cp $ROOT_PATH /build/libs/leets-0.0.1-SNAPSHOT.jar $JAR
14
+
15
+ echo " [$NOW ] > $JAR 실행" >> $START_LOG
16
+ nohup java -jar $JAR > $APP_LOG 2> $ERROR_LOG &
17
+
18
+ SERVICE_PID=$( pgrep -f $JAR )
19
+ echo " [$NOW ] > 서비스 PID: $SERVICE_PID " >> $START_LOG
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ ROOT_PATH=" /home/ec2-user/Leets/LEETS"
4
+ JAR=" $ROOT_PATH /application.jar"
5
+ STOP_LOG=" $ROOT_PATH /stop.log"
6
+ SERVICE_PID=$( pgrep -f $JAR ) # 실행중인 Spring 서버의 PID
7
+
8
+ if [ -z " $SERVICE_PID " ]; then
9
+ echo " 서비스 NouFound" >> $STOP_LOG
10
+ else
11
+ echo " 서비스 종료 " >> $STOP_LOG
12
+ kill " $SERVICE_PID "
13
+ # kill -9 $SERVICE_PID # 강제 종료를 하고 싶다면 이 명령어 사용
14
+ fi
You can’t perform that action at this time.
0 commit comments