forked from pytonic/openzaly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
40 lines (30 loc) · 821 Bytes
/
start.sh
File metadata and controls
40 lines (30 loc) · 821 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
#!/bin/bash
PORT=$1
PORT2=$2
##set tcp port
if [ -n $PORT ]; then
PORT=2021
fi
##set http port
if [ -n $PORT2 ]; then
PORT2=8080
fi
echo "------------start openzaly tcp:port="$PORT" http port="$PORT2
JAVA_JAR="openzaly-boot-jar-with-dependencies"
PID=$(ps -ef|grep $JAVA_JAR|grep $PORT |head -1| awk '{printf $2}')
#如果存在PID,直接退出,不存在继续执行
if [ $PID > 0 ]; then
echo "Exist PID:"$PID
exit
else
echo "execute Java -P="$PORT
fi
java -Dsite.port=$PORT -Dhttp.port=$PORT2 -jar openzaly-boot-jar-with-dependencies.jar >>stdout.log 2>&1 &
PID=$(ps -ef|grep $JAVA_JAR|grep $PORT |head -1| awk '{printf $2}')
if [ $? -eq 0 ]; then
echo "Process id:$PID"
else
echo "Process $PORT not exit"
exit
fi
echo "start TCP PORT="$PORT",HTTP PORT=$PORT2,PID=$PID success"