You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

12 lines
580 B

# -*- coding: utf-8 -*-
"""票 06 打包前置:查 8080 java 进程(锁 jar 需先杀)。"""
import io, subprocess, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
p = subprocess.run(['tasklist', '/FI', 'IMAGENAME eq java.exe', '/FO', 'CSV'],
capture_output=True, text=True, errors='replace')
print(p.stdout)
q = subprocess.run(['netstat', '-ano'], capture_output=True, text=True, errors='replace')
for line in (q.stdout or '').splitlines():
if ':8080' in line and 'LISTENING' in line:
print("PORT8080:", line.strip())