Commit 0ac10491685b4947013dd053c3714857547c7bbe
1 parent
186753da
Exists in
master
修正端口占用检测
Showing
1 changed file
with
11 additions
and
10 deletions
Show diff stats
ngrok.sh
... | ... | @@ -184,20 +184,20 @@ function fun_check_port(){ |
184 | 184 | strHttpsPort="" |
185 | 185 | strRemotePort="" |
186 | 186 | strManPort="" |
187 | - strHttpPort=`netstat -ntl | grep ":${http_port}"` | |
188 | - strHttpsPort=`netstat -ntl | grep ":${https_port}"` | |
189 | - strRemotePort=`netstat -ntl | grep ":${remote_port}"` | |
190 | - strManagePort=`netstat -ntl | grep ":${manage_port}"` | |
187 | + strHttpPort=`netstat -ntl | grep "\b:${http_port}\b"` | |
188 | + strHttpsPort=`netstat -ntl | grep "\b:${https_port}\b"` | |
189 | + strRemotePort=`netstat -ntl | grep "\b:${remote_port}\b"` | |
190 | + strManagePort=`netstat -ntl | grep "\b:${manage_port}\b"` | |
191 | 191 | if [ -n "${strHttpPort}" ] || [ -n "${strHttpsPort}" ] || [ -n "${strRemotePort}" ] || [ -n "${strManagePort}" ]; then |
192 | 192 | [ -n "${strHttpPort}" ] && str_http_port="${http_port}" |
193 | 193 | [ -n "${strHttpsPort}" ] && str_https_port="${https_port}" |
194 | 194 | [ -n "${strRemotePort}" ] && str_remote_port="${remote_port}" |
195 | 195 | [ -n "${strManagePort}" ] && str_manage_port="${manage_port}" |
196 | - echo "Error: Port ${str_http_port} ${str_https_port} ${str_remote_port} ${str_manage_port} is used,view relevant port:" | |
197 | - [ -n "${strHttpPort}" ] && netstat -apn | grep ":${http_port}" | |
198 | - [ -n "${strHttpsPort}" ] && netstat -apn | grep ":${https_port}" | |
199 | - [ -n "${strRemotePort}" ] && netstat -apn | grep ":${remote_port}" | |
200 | - [ -n "${strManagePort}" ] && netstat -apn | grep ":${manage_port}" | |
196 | + echo -e "Error: Port \033[32m${str_http_port} ${str_https_port} ${str_remote_port} ${str_manage_port}\033[0m is \033[31m\033[01mused\033[0m,view relevant port:" | |
197 | + [ -n "${strHttpPort}" ] && netstat -apn | grep "\b:${http_port}\b" | |
198 | + [ -n "${strHttpsPort}" ] && netstat -apn | grep "\b:${https_port}\b" | |
199 | + [ -n "${strRemotePort}" ] && netstat -apn | grep "\b:${remote_port}\b" | |
200 | + [ -n "${strManagePort}" ] && netstat -apn | grep "\b:${manage_port}\b" | |
201 | 201 | exit 1 |
202 | 202 | fi |
203 | 203 | } |
... | ... | @@ -277,7 +277,8 @@ function deluser_Confirm_clang(){ |
277 | 277 | if [ $strConfirmDel = "y" ]; then |
278 | 278 | if [ -s "/tmp/db-diskv/ng/ro/ngrok:${strDelUser}" ]; then |
279 | 279 | rm -f /tmp/db-diskv/ng/ro/ngrok:${strDelUser} |
280 | - echo -e "Delete user \033[32m${strDelUser}\033[0m ok!" | |
280 | + echo -e "Delete user \033[32m${strDelUser}\033[0m ok! Restart Ngrok..." | |
281 | + restart_ngrok_clang | |
281 | 282 | else |
282 | 283 | echo "" |
283 | 284 | echo -e "Error: user \033[32m${strDelUser}\033[0m not found!" | ... | ... |