-
Notifications
You must be signed in to change notification settings - Fork 0
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
36 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,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
REPOSITORY=/home/ec2-user/app | ||
|
||
cd $REPOSITORY | ||
|
||
CURRENT_PID=$(pgrep -fla java | grep common | awk '{print $1}') | ||
|
||
echo "현재 구동중인 애플리케이션 pid : $CURRENT_PID" | ||
|
||
if [ -z $CURRENT_PID ] | ||
then | ||
echo "> Nothing to end." | ||
else | ||
echo "> kill -9 $CURRENT_PID" | ||
kill -15 $CURRENT_PID | ||
sleep 5 | ||
fi | ||
|
||
echo "> 새 애플리케이션 배포" | ||
|
||
JAR_NAME=$(ls $REPOSITORY/ | grep '*.jar' | tail -n 1) | ||
echo "Jar Name : $JAR_NAME" | ||
|
||
echo "$JAR_NAME 에 실행권한 추가" | ||
chmod +x $JAR_NAME | ||
|
||
|
||
JAR_PATH=$REPOSITORY/$JAR_NAME | ||
echo "Jar Path : $JAR_PATH" | ||
|
||
echo "> $JAR_PATH deploy" | ||
nohup java -jar \ | ||
-Duser.timezone=Asia/Seoul \ | ||
-Dspring.profiles.active=prod \ | ||
$JAR_NAME >> $REPOSITORY/logs/log_$(date +\%Y\%m\%d).log 2>&1 & |