-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
44 lines (32 loc) · 959 Bytes
/
deploy.sh
File metadata and controls
44 lines (32 loc) · 959 Bytes
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
#!/bin/bash
echo -e "\nMomo Deploy Start!!!"
# Set Profile
PROFILE="dev"
echo " > current profile : ${PROFILE}"
# Set Variables
JAR_PATH="./momo/momo-0.0.1-SNAPSHOT.jar"
PROCESS_NAME="momo"
LOG_FILE="application.log"
# Process Detect And Terminate Task
echo -e "\nReady to terminate current process..."
PROCESS_NAME="momo"
PID=$(pgrep -f "${PROCESS_NAME}")
if [ -z "${PID}" ]; then
echo " > process not detected!!"
else
echo " > process detected!!"
pgrep -f "${PROCESS_NAME}" |
while read -r line; do
echo " > terminate process $line"
kill -15 "$line"
done
fi
while (lsof -Pi :8080 -sTCP:LISTEN | grep 8080); do
sleep 1
done
echo " > Process Terminate Success!!"
# Jar Execution Task
echo -e "\nReady to execute jar..."
chmod +x ./momo/momo-0.0.1-SNAPSHOT.jar
nohup java -jar "${JAR_PATH}" --spring.profiles.active="${PROFILE}" -Duser.timezone="Asia/Seoul" >> "${LOG_FILE}" 2>/dev/null &
echo " > Jar Execute Success!!"