From 864f34da68542f9730413ca347d8d49f8aa848b5 Mon Sep 17 00:00:00 2001 From: yeji Date: Fri, 15 Mar 2024 23:52:00 +0900 Subject: [PATCH] =?UTF-8?q?deploy:=20start.sh=EA=B3=BC=20stop.sh=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EC=84=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 20 +++++++++++--------- scripts/stop.sh | 20 +++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 8f0d218..063e4f1 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -3,17 +3,19 @@ PROJECT_ROOT="/home/ubuntu" JAR_FILE="$PROJECT_ROOT/ebus-app.jar" +APP_LOG="$PROJECT_ROOT/application.log" +ERROR_LOG="$PROJECT_ROOT/error.log" DEPLOY_LOG="$PROJECT_ROOT/deploy.log" TIME_NOW=$(date +%c) -# 현재 구동 중인 애플리케이션 pid 확인 -CURRENT_PID=$(pgrep -f $JAR_FILE) +# build 파일 복사 +echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG +cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE + +# jar 파일 실행 +echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG +nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG & -# 프로세스가 켜져 있으면 종료 -if [ -z $CURRENT_PID ]; then - echo "$TIME_NOW > 현재 실행중인 애플리케이션이 없습니다" >> $DEPLOY_LOG -else - echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료" >> $DEPLOY_LOG - kill -15 $CURRENT_PID -fi \ No newline at end of file +CURRENT_PID=$(pgrep -f $JAR_FILE) +echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG \ No newline at end of file diff --git a/scripts/stop.sh b/scripts/stop.sh index 063e4f1..8f0d218 100644 --- a/scripts/stop.sh +++ b/scripts/stop.sh @@ -3,19 +3,17 @@ PROJECT_ROOT="/home/ubuntu" JAR_FILE="$PROJECT_ROOT/ebus-app.jar" -APP_LOG="$PROJECT_ROOT/application.log" -ERROR_LOG="$PROJECT_ROOT/error.log" DEPLOY_LOG="$PROJECT_ROOT/deploy.log" TIME_NOW=$(date +%c) -# build 파일 복사 -echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG -cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE - -# jar 파일 실행 -echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG -nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG & - +# 현재 구동 중인 애플리케이션 pid 확인 CURRENT_PID=$(pgrep -f $JAR_FILE) -echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG \ No newline at end of file + +# 프로세스가 켜져 있으면 종료 +if [ -z $CURRENT_PID ]; then + echo "$TIME_NOW > 현재 실행중인 애플리케이션이 없습니다" >> $DEPLOY_LOG +else + echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료" >> $DEPLOY_LOG + kill -15 $CURRENT_PID +fi \ No newline at end of file