-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |