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.

30 lines
1.4 KiB

7 days ago
# -*- coding: utf-8 -*-
"""票 04:判别 8080 服务版本(api-docs 是否含 customer/add)+ java 进程与 jar 修改时间。"""
import io, sys, subprocess, os, glob, time
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import requests
try:
r = requests.get('http://localhost:8080/v3/api-docs', timeout=10)
txt = r.text
hit_add = '/api/opportunity/customer/add' in txt
hit_search = '/api/opportunity/customer/search' in txt
hit_team = '/api/opportunity/team/add' in txt
print(f"[api-docs] HTTP {r.status_code} customer/add={hit_add} customer/search={hit_search} team/add={hit_team}")
except Exception as e:
print(f"[api-docs] FAIL {type(e).__name__}: {e}")
r = subprocess.run(['tasklist'], capture_output=True, text=True, timeout=10)
javas = [l.split() for l in r.stdout.splitlines() if l.lower().startswith('java')]
print('[java procs]', [(p[0], p[1]) for p in javas])
jar = r'e:\code\crm-backend-matt\crm-app\target\crm-app-1.0.0-SNAPSHOT.jar'
st = os.stat(jar)
print('[jar] mtime=', time.strftime('%H:%M:%S', time.localtime(st.st_mtime)), ' size=', st.st_size)
r2 = subprocess.run(['wmic', 'process', 'where', "name='java.exe'", 'get', 'ProcessId,CommandLine'],
capture_output=True, text=True, timeout=15)
for line in r2.stdout.splitlines():
if 'crm-app' in line or 'java' in line.lower():
print('[cmdline]', line.strip()[:220])