-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-app.sh
38 lines (31 loc) · 1.01 KB
/
start-app.sh
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
#!/bin/bash
. ./app-env.sh
SERVICE_PROCESS="library-react"
PS_OUT=""
PROCESS_ID=""
JAVA_OPT=" -Dspring.profiles.active=${PROFILE} "
JAVA_OPT=${JAVA_OPT}" -DMYSQL_HOST=${MYSQL_HOST} "
JAVA_OPT=${JAVA_OPT}" -Dspring.datasource.hikari.username=${DB_USERNAME} "
JAVA_OPT=${JAVA_OPT}" -Dspring.datasource.hikari.password=${DB_PASSWORD} "
JAVA_OPT=${JAVA_OPT}" -DHOSTNAME=${HOSTNAME} "
process_check(){
PS_OUT=`ps -ef | grep -v grep | grep ${SERVICE_PROCESS} `
if [[ ${PS_OUT} != "" ]]; then
PROCESS_ID=`echo ${PS_OUT} | awk '{print $2}'`
echo "${SERVICE_PROCESS}(${PROCESS_ID}) is running now."
else
echo "${SERIVCE_PROCESS} is not running. please check your service."
fi
}
kill_process(){
if [[ "${PROCESS_ID}" != "" ]]; then
RESULT=`kill -9 ${PROCESS_ID}`
sleep 2
echo "${SERVICE_PROCESS}(${PROCESS_ID}) is killed."
fi
}
process_check
kill_process
echo "JAVA_OPT=${JAVA_OPT}"
nohup java -jar ${JAVA_OPT} /data/library-react.jar 1>/dev/null 2>&1 &
process_check