1234567891011121314151617 |
- import os, io, sys, platform, shutil, time, json, datetime
- from api.utils import shell_execute
- # 根据.env文件提供的port,找出能正常启动的最小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
|