Skip to content

Commit

Permalink
update start.sh, stop.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
habinkim committed Apr 4, 2024
1 parent 868c12f commit e04d68e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
PROJECT_ROOT="/home/habin/action"
JAR_FILE=$PROJECT_ROOT/build/libs/tune_fun-0.0.1-SNAPSHOT.jar
JAR_FILE=$PROJECT_ROOT/tune_fun-0.0.1-SNAPSHOT.jar

APP_LOG=$PROJECT_ROOT/app.log
ERROR_LOG=$PROJECT_ROOT/error.log
Expand All @@ -12,11 +12,11 @@ TIME_NOW=$(date +%c)

# build 파일 복사
echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG
cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE
cp $PROJECT_ROOT/build/libs/tune_fun-0.0.1-SNAPSHOT.jar $JAR_FILE

# jar 파일 실행
echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG
nohup $JAVA_EXECUTABLE -jar $JAR_FILE --spring.profiles.active=dev > $APP_LOG 2> $ERROR_LOG &

CURRENT_PID=$(pgrep -f $JAR_FILE)
echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG
echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG
8 changes: 4 additions & 4 deletions scripts/stop.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
PROJECT_ROOT="/home/habin/action"
JAR_FILE=$PROJECT_ROOT/build/libs/tune_fun-0.0.1-SNAPSHOT.jar
JAR_FILE=$PROJECT_ROOT/tune_fun-0.0.1-SNAPSHOT.jar

DEPLOY_LOG=$PROJECT_ROOT/deploy.log

Expand All @@ -10,9 +10,9 @@ TIME_NOW=$(date +%c)
CURRENT_PID=$(pgrep -f $JAR_FILE)

# 프로세스가 켜져 있으면 종료
if [ -z $CURRENT_PID ]; then
if [ -z "$CURRENT_PID" ]; then
echo "$TIME_NOW > 현재 실행중인 애플리케이션이 없습니다" >> $DEPLOY_LOG
else
echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료 " >> $DEPLOY_LOG
kill -15 $CURRENT_PID
fi
kill -15 "$CURRENT_PID"
fi

0 comments on commit e04d68e

Please sign in to comment.