mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-01-24 18:30:23 +08:00
22 lines
518 B
Python
22 lines
518 B
Python
import os, io, sys, platform, shutil, time, json, datetime
|
||
from api.utils import shell_execute
|
||
|
||
# 根据依赖文件提供的port,判断是否启动
|
||
def get_start_port(port):
|
||
print("目前检查"+port+"是否被占用")
|
||
use_port = port
|
||
output = "ok"
|
||
while True:
|
||
cmd = "netstat -anp|grep "+use_port
|
||
output = shell_execute.execute_CommandReturn(cmd)
|
||
if output == "":
|
||
break
|
||
else:
|
||
use_port = use_port+1
|
||
|
||
return use_port
|
||
|
||
|
||
|
||
|