From 408dcd90a75a8e062f4a8bd4a08cc96a815415f6 Mon Sep 17 00:00:00 2001 From: wulabing Date: Mon, 5 Mar 2018 15:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=2080=20=E7=AB=AF=E5=8F=A3=20?= =?UTF-8?q?GCE=20=E6=A3=80=E6=B5=8B=E5=8D=A0=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 80 端口 GCE 检测占用问题 --- install.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 43cd596..8c4cbe3 100644 --- a/install.sh +++ b/install.sh @@ -250,9 +250,13 @@ port_exist_check(){ echo -e "${OK} ${GreenBG} $1 端口未被占用 ${Font}" sleep 1 else - echo -e "${Error} ${RedBG} $1 端口被占用,请检查占用进程 结束后重新运行脚本 ${Font}" - netstat -tlpn | grep "$1" - exit 1 + echo -e "${Error} ${RedBG} 检测到 $1 端口被占用,以下为 $1 端口占用信息 ${Font}" + lsof -i:"$1" + echo -e "${OK} ${GreenBG} 5s 后将尝试自动 kill 占用进程 ${Font}" + sleep 5 + lsof -i:"$1" | awk '{print $2}'| grep -v "PID" | xargs kill -9 + echo -e "${OK} ${GreenBG} kill 完成 ${Font}" + sleep 1 fi } acme(){