Skip to content

Commit

Permalink
add deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
KiSeungMin committed Jul 17, 2024
1 parent 3f0ad0b commit c28cd62
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 1 addition & 4 deletions appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ permissions:

hooks:
AfterInstall:
- location: scripts/stop.sh
timeout: 60
ApplicationStart:
- location: scripts/start.sh
- location: scripts/deploy.sh
timeout: 60
22 changes: 22 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

REPOSITORY=/home/ubuntu/backend
cd $REPOSITORY

APP_NAME=moduform
JAR_NAME=$(ls $REPOSITORY/build/libs/ | grep 'backend-0.0.1-SNAPSHOT.jar' | tail -n 1)
JAR_PATH=$REPOSITORY/build/libs/$JAR_NAME

CURRENT_PID=$(pgrep -f $APP_NAME)

if [ -z $CURRENT_PID ]
then
echo "> 종료할 애플리케이션이 없습니다."
else
echo "> kill -9 $CURRENT_PID"
kill -15 $CURRENT_PID
sleep 5
fi

echo "> Deploy - $JAR_PATH "
nohup java -jar $JAR_PATH > /dev/null 2> /dev/null < /dev/null &

0 comments on commit c28cd62

Please sign in to comment.