From ab8765191eb68a5066c50b49bc4f298eab7a6a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Wed, 28 Jun 2017 16:12:14 +0800 Subject: [PATCH] update initmudbjson.sh --- initmudbjson.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/initmudbjson.sh b/initmudbjson.sh index b1dee3f..c5f1e3e 100755 --- a/initmudbjson.sh +++ b/initmudbjson.sh @@ -7,8 +7,11 @@ ip_count=`echo $ip_addr|grep -e "^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$" -c` if [[ $ip_count == 1 ]]; then echo "server IP is "${ip_addr} sed -i 's/SERVER_PUB_ADDR = .\+/SERVER_PUB_ADDR = '${ip_addr}'/g' userapiconfig.py - port=`python -c 'import random;print(random.randint(10000, 65536))'` - python mujson_mgr.py -a -p ${port} + user_count=`python mujson_mgr.py -l|grep -c ""` + if [[ $user_count == 0 ]]; then + port=`python -c 'import random;print(random.randint(10000, 65536))'` + python mujson_mgr.py -a -p ${port} + fi else echo "unable to detect server IP" fi