#!/usr/bin/env python3 import subprocess import glob import os # Проверяем процессы print("🔍 АКТИВНЫЕ ПРОЦЕССЫ КРАУЛЕРА:\n") try: result = subprocess.run(['ps', 'aux'], capture_output=True, text=True) for line in result.stdout.split('\n'): if 'mass_crawler.py' in line and 'grep' not in line: print(f" {line}") except: print(" ❌ Ошибка проверки процессов") # Проверяем логи print("\n📄 ФАЙЛЫ ЛОГОВ КРАУЛЕРА:\n") log_files = glob.glob('/root/engine/public_oversight/hotels/mass_crawler_*.log') log_files.sort(key=os.path.getmtime, reverse=True) for i, log_file in enumerate(log_files[:5]): size = os.path.getsize(log_file) / 1024 # KB mtime = os.path.getmtime(log_file) from datetime import datetime mod_time = datetime.fromtimestamp(mtime).strftime('%Y-%m-%d %H:%M:%S') print(f" {i+1}. {os.path.basename(log_file)}") print(f" Размер: {size:.1f} KB") print(f" Изменён: {mod_time}") # Читаем последние строки try: with open(log_file, 'r') as f: lines = f.readlines() if lines: print(f" Строк: {len(lines)}") # Последние 3 строки for line in lines[-3:]: line = line.strip() if line: print(f" {line[:80]}...") except: pass print()