修复极简安装端口占用判断错误问题

This commit is contained in:
jianghongbo4 2023-01-19 15:50:19 +08:00
parent b2a5d20e8b
commit 8151036ef1
1 changed files with 13 additions and 5 deletions

View File

@ -88,11 +88,19 @@ function check_install_env() {
fi
# check pid port and lock file
port_occupied=$(netstat -ntul | grep $port)
if [ X"$port_occupied" != X"" ]; then
error "Error: The port $port has been occupied, please use -p to set a new port."
exit 1
fi
portlist=($(netstat -nutl | grep $port))
i=3
while ((i < ${#portlist[*]}))
do
listen_addr=${portlist[((i))]}
p=${listen_addr##*:}
echo $p
if [ X"$p" == X"$port" ]; then
error "Error: The port $port has been occupied, please use -p to set a new port."
exit 1
fi
((i += 6))
done
local delete_slave_lock=""
local delete_master_lock=""