Skip to content

Commit

Permalink
fix : shell
Browse files Browse the repository at this point in the history
  • Loading branch information
sunghyun0610 committed Jan 8, 2025
1 parent 8c0288b commit 8b90a0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
10 changes: 3 additions & 7 deletions meerket/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ 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
# jar 파일 실행
echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG
nohup java -jar $JAR_FILE > $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
17 changes: 11 additions & 6 deletions meerket/scripts/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ DEPLOY_LOG="$PROJECT_ROOT/deploy.log"

TIME_NOW=$(date +%c)

#현재 구동 중인 애플리케이션 pid 확인
# 현재 구동 중인 애플리케이션 PID 확인
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 -9 $CURRENT_PID
fi
echo "$TIME_NOW > 실행중인 $CURRENT_PID 애플리케이션 종료" >> $DEPLOY_LOG
kill $CURRENT_PID
sleep 5
if kill -0 $CURRENT_PID 2>/dev/null; then
echo "$TIME_NOW > 강제 종료 필요: $CURRENT_PID" >> $DEPLOY_LOG
kill -9 $CURRENT_PID
fi
fi

0 comments on commit 8b90a0b

Please sign in to comment.