Skip to content

Commit

Permalink
deploy.sh 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jin20fd committed Jul 21, 2024
1 parent daf8afd commit 83743a9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions TWO/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# 현재 실행 중인 .jar 프로세스의 PID를 가져옵니다.
CURRENT_PID=$(pgrep -f .jar)
echo "Current PID: $CURRENT_PID"

# 실행 중인 프로세스가 있으면 종료합니다.
if [ -z "$CURRENT_PID" ]; then
echo "No running process found."
else
echo "Killing process $CURRENT_PID"
kill -9 $CURRENT_PID
sleep 3
fi

# 새로운 JAR 파일의 경로를 설정합니다.
JAR_PATH="/home/ec2-user/cicd/*.jar"
echo "JAR Path: $JAR_PATH"

# JAR 파일에 실행 권한을 부여합니다.
chmod +x $JAR_PATH

# JAR 파일을 백그라운드에서 실행합니다.
nohup java -jar $JAR_PATH > /dev/null 2> /dev/null < /dev/null &
echo "Deployment successful."

0 comments on commit 83743a9

Please sign in to comment.