Skip to content

Commit

Permalink
fix: 目标机器上用Docker拉起MySQL同时监听IPv4与IPv6端口后SQL脚本执行异常 TencentBlueKing#1992
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliaozhong committed Sep 19, 2023
1 parent fc2c309 commit 6e1658f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ timeSec=`date +'%s'`
LOG=/tmp/result_${SCRIPT_NAME}_${timeSec}.log

if [ ${PORT} -gt 0 ]; then
HOST_AND_PORT=`netstat -ntl | grep ":${PORT} " | awk '{print $4}'`
HOST_AND_PORT=`netstat -ntl | grep ":${PORT} " | awk '{print $4}' | head -n 1`
HOST=${HOST_AND_PORT%:${PORT}}
if [ ${HOST} = '0.0.0.0' -o ${HOST} = '::' ];then
HOST='127.0.0.1'
Expand Down

0 comments on commit 6e1658f

Please sign in to comment.