Files
hotels/quick_check.py

45 lines
1.3 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
import subprocess
import os
os.chdir('/root/engine/public_oversight/hotels')
# Проверяем процессы
result = subprocess.run(['ps', 'aux'], capture_output=True, text=True, timeout=5)
print("🔍 ПРОЦЕССЫ КРАУЛЕРА:")
for line in result.stdout.split('\n'):
if 'mass_crawler.py' in line and 'grep' not in line:
parts = line.split()
print(f"\n✅ PID: {parts[1]}")
print(f" CPU: {parts[2]}%")
print(f" RAM: {parts[3]}%")
print(f" Команда: {' '.join(parts[10:])}")
# Проверяем последний лог
import glob
from datetime import datetime
logs = sorted(glob.glob('mass_crawler_*.log'), key=os.path.getmtime, reverse=True)
if logs:
latest = logs[0]
mtime = datetime.fromtimestamp(os.path.getmtime(latest)).strftime('%H:%M:%S')
size = os.path.getsize(latest)
print(f"\n📄 ПОСЛЕДНИЙ ЛОГ: {latest}")
print(f" Изменён: {mtime}")
print(f" Размер: {size:,} байт")
# Последние 10 строк
with open(latest, 'r') as f:
lines = f.readlines()
print(f"\n📋 ПОСЛЕДНИЕ СТРОКИ ({len(lines)} всего):")
for line in lines[-10:]:
if line.strip():
print(f" {line.rstrip()}")