bug fix and shell optimization

This commit is contained in:
Gordon
2021-09-13 15:48:19 +08:00
parent c1bcadd9ed
commit 649bc5657e
14 changed files with 72 additions and 42 deletions
+3 -3
View File
@@ -20,7 +20,7 @@ fi
check=$(ps aux | grep -w ./${msg_gateway_name} | grep -v grep | wc -l)
if [ $check -ge 1 ]; then
oldPid=$(ps aux | grep -w ./${msg_gateway_name} | grep -v grep | awk '{print $2}')
kill -9 ${oldPid}
kill -9 ${oldPid}
fi
#Waiting port recycling
sleep 3
@@ -36,8 +36,8 @@ allPorts=""
if [ $check -ge 1 ]; then
allNewPid=$(ps aux | grep -w ./${msg_gateway_name} | grep -v grep | awk '{print $2}')
for i in $allNewPid; do
ports=$(netstat -netulp | grep ${i} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
allPorts=${allPorts}"$ports "
ports=$(netstat -netulp | grep -w ${i} | awk '{print $4}' | awk -F '[:]' '{print $NF}')
allPorts=${allPorts}"$ports "
done
echo -e ${SKY_BLUE_PREFIX}"SERVICE START SUCCESS !!!"${COLOR_SUFFIX}
echo -e ${SKY_BLUE_PREFIX}"SERVICE_NAME: "${COLOR_SUFFIX}${YELLOW_PREFIX}${msg_gateway_name}${COLOR_SUFFIX}