"""快速检查 ETL 日志尾部 — 一次性脚本""" import os, sys LOG = r"C:\NeoZQYY\export\ETL-Connectors\feiqiu\LOGS\2681a85399e64c76a040163f956e1907.log" f = open(LOG, "rb") f.seek(0, 2) sz = f.tell() print(f"文件大小: {sz} bytes") f.seek(max(0, sz - 8000)) data = f.read().decode("utf-8", "replace") f.close() lines = data.splitlines() for l in lines[-50:]: print(l) # 检查进程 try: import subprocess r = subprocess.run( ["powershell", "-Command", "Get-Process -Id 19972 -ErrorAction SilentlyContinue | Select-Object Id,CPU"], capture_output=True, text=True, timeout=5 ) print(f"\n进程 19972 状态: {r.stdout.strip() if r.stdout.strip() else '已退出'}") except Exception as e: print(f"\n进程检查失败: {e}")