Skip to content

Commit b31c8ae

Browse files
authored
Merge pull request #1144 from clementchong/hotfix-1126
Run multiple datart-server.sh on same box
2 parents fe54ce3 + e1fe841 commit b31c8ae

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

bin/datart-server.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ START_CLASS="datart.DatartServerApplication"
2929
#java -server -Xms2G -Xmx2G -Dspring.profiles.active=config -Dfile.encoding=UTF-8 -cp "${CLASS_PATH}" datart.DatartServerApplication
3030

3131
datart_status(){
32-
result=`ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}' | wc -l`
32+
#result=`ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}' | wc -l`
33+
result=`ps -ef | grep -v grep | grep "${BASE_DIR}/lib" | grep 'DatartServerApplication' | awk {'print $2'} | wc -l`
3334

3435
if [[ $result -eq 0 ]]; then
3536
return 0
@@ -47,7 +48,8 @@ datart_start(){
4748

4849
else
4950
echo ""
50-
PID=`ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}'`
51+
#PID=`ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}'`
52+
PID=`ps -ef | grep -v grep | grep "${BASE_DIR}/lib" | grep 'DatartServerApplication' | awk {'print $2'}`
5153
echo "Datart is Running Now..... PID is ${PID} "
5254
fi
5355
}
@@ -60,7 +62,8 @@ datart_stop(){
6062
echo "Datart is not Running....."
6163
echo ""
6264
else
63-
ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}'| xargs kill -9
65+
#ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}'| xargs kill -9
66+
ps -ef | grep -v grep | grep "$BASE_DIR/lib" | grep 'DatartServerApplication' | awk {'print $2'} | xargs kill -9
6467

6568
fi
6669
}
@@ -77,7 +80,7 @@ case $1 in
7780
stop )
7881
echo ""
7982

80-
echo "Datart Stoping.......... "
83+
echo "Datart Stopping.......... "
8184

8285
echo ""
8386
datart_stop
@@ -100,7 +103,8 @@ case $1 in
100103
echo ""
101104
else
102105
echo ""
103-
PID=`ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}'`
106+
#PID=`ps -ef | awk '/DatartServerApplication/ && !/awk/{print $2}'`
107+
PID=`ps -ef | grep -v grep | grep "${BASE_DIR}/lib" | grep 'DatartServerApplication' | awk {'print $2'}`
104108
echo "Datart is Running..... PID is ${PID}"
105109
echo ""
106110
fi

0 commit comments

Comments
 (0)