-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdeploy.sh
More file actions
47 lines (29 loc) ยท 1.01 KB
/
deploy.sh
File metadata and controls
47 lines (29 loc) ยท 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
REPOSITORY=/home/ubuntu/app/mentos
PROJECT_NAME=Mentos-Server
cd $REPOSITORY/$PROJECT_NAME/
echo "> Git Pull"
git pull origin main
echo "> Start Building Project"
sudo ./gradlew clean build
echo "> Change Directory to Test"
cd $REPOSITORY
echo "> Copy Build Files"
cp $REPOSITORY/$PROJECT_NAME/build/libs/*.jar $REPOSITORY/
echo "> Check Current Application Pids"
# pgrep : process id๋ง ์ถ์ถ
# -f : process ์ด๋ฆ์ผ๋ก ๊ฒ์
CURRENT_PID=$(pgrep -f mentos)
echo "> Current Application Pids : $CURRENT_PID"
if [ -z "$CURRENT_PID" ] ; then
echo "> ํ์ฌ ๊ตฌ๋์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
์ด ์์ผ๋ฏ๋ก ์ข
๋ฃํ์ง ์์ต๋๋ค."
else
echo "> kill -9 $CURRENT_PID"
kill -9 $CURRENT_PID
sleep 20
fi
echo "> Deploy New Application"
# ์๋ก ์คํํ jarํ์ผ ์ฐพ์์
# ์ฌ๋ฌ jarํ์ผ ์ค ๊ฐ์ฅ ๋ง์ง๋ง(์ต์ ) ํ์ผ์ ๋ณ์์ ์ ์ฅ
JAR_NAME=$(ls $REPOSITORY/ | grep 'mentos' | tail -n 1)
echo "> JAR NAME :$JAR_NAME"
nohup java -jar $JAR_NAME > $REPOSITORY/nohup.out 2>&1 &