deploy-script-for-simple-project

#tip

jar

PID=$(jps | grep baseball09-0.0.1-SNAPSHOT.jar | awk '{print $1}')
GIT_REPO="https://github.com/codesquad-member-2020/baseball-09.git"
kill -9 $PID
sleep 1
rm -rf baseball-09
git clone -b $1 --single-branch $GIT_REPO
sleep 1
cd baseball-09
cd BE
./gradlew build -x test
sleep 1
cd build/libs
nohup java -jar -Dspring.profiles.active=prod baseball09-0.0.1-SNAPSHOT.jar &

#!/usr/bin/env bash

REPOSITORY=/opt/testapp
cd $REPOSITORY

APP_NAME=action # model name
JAR_NAME=$(ls $REPOSITORY/build/libs/ | grep '.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 "> $JAR_PATH ๋ฐฐํฌ"
nohup java -jar $JAR_PATH > /dev/null 2> /dev/null < /dev/null &


airbnb 11

์Šคํฌ๋ฆฝํŠธ ์ž‘์„ฑ ํ›„

  • chmod +x script.sh ๋ฅผ ํ•ด์ค˜์•ผ ์‹คํ–‰๊ถŒํ•œ์„ ์ฃผ๋Š” ์…ˆ

Last updated

Was this helpful?