Files
hotels/check_crawler_status.sh
Фёдор 0cf3297290 Проект аудита отелей: основные скрипты и документация
- Краулеры: smart_crawler.py, regional_crawler.py
- Аудит: audit_orel_to_excel.py, audit_chukotka_to_excel.py
- РКН проверка: check_rkn_registry.py, recheck_unclear_rkn.py
- Отчёты: create_orel_horizontal_report.py
- Обработка: process_all_hotels_embeddings.py
- Документация: README.md, DB_SCHEMA_REFERENCE.md
2025-10-16 10:52:09 +03:00

87 lines
3.9 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Скрипт для проверки статуса краулера
echo "═══════════════════════════════════════════════════════════════"
echo "🔍 СТАТУС МАССОВОГО КРАУЛИНГА"
echo "═══════════════════════════════════════════════════════════════"
# Проверка процесса
if ps aux | grep -v grep | grep "mass_crawler.py" > /dev/null; then
PID=$(ps aux | grep -v grep | grep "mass_crawler.py" | awk '{print $2}')
CPU=$(ps aux | grep -v grep | grep "mass_crawler.py" | awk '{print $3}')
MEM=$(ps aux | grep -v grep | grep "mass_crawler.py" | awk '{print $4}')
echo "✅ Краулер РАБОТАЕТ"
echo " PID: $PID"
echo " CPU: ${CPU}%"
echo " MEM: ${MEM}%"
else
echo "❌ Краулер НЕ РАБОТАЕТ"
fi
echo ""
echo "───────────────────────────────────────────────────────────────"
echo "📊 ПРОГРЕСС ИЗ БАЗЫ ДАННЫХ:"
echo "───────────────────────────────────────────────────────────────"
python3 << 'EOF'
import psycopg2
from urllib.parse import unquote
conn = psycopg2.connect(
host='147.45.189.234',
port=5432,
database='default_db',
user='gen_user',
password=unquote('2~~9_%5EkVsU%3F2%5CS')
)
cur = conn.cursor()
# Статистика
cur.execute("SELECT COUNT(DISTINCT id) FROM hotel_main WHERE website_address IS NOT NULL AND website_address != ''")
total_with_sites = cur.fetchone()[0]
cur.execute("SELECT COUNT(DISTINCT hotel_id) FROM hotel_website_meta")
crawled = cur.fetchone()[0]
remaining = total_with_sites - crawled
progress = (crawled / total_with_sites * 100) if total_with_sites > 0 else 0
print(f"Всего отелей с сайтами: {total_with_sites}")
print(f"Обработано: {crawled} ({progress:.1f}%)")
print(f"Осталось: {remaining}")
# Последние обработанные
cur.execute("""
SELECT hotel_name, region_name, pages_crawled, crawled_at
FROM hotel_website_meta
ORDER BY crawled_at DESC
LIMIT 5
""")
print("\n───────────────────────────────────────────────────────────────")
print("🏨 ПОСЛЕДНИЕ 5 ОБРАБОТАННЫХ ОТЕЛЕЙ:")
print("───────────────────────────────────────────────────────────────")
for row in cur.fetchall():
print(f" • {row[0][:50]} ({row[1]})")
print(f" Страниц: {row[2]}, Время: {row[3]}")
conn.close()
EOF
echo ""
echo "───────────────────────────────────────────────────────────────"
echo "📋 ПОСЛЕДНИЕ 15 СТРОК ЛОГА:"
echo "───────────────────────────────────────────────────────────────"
if [ -f "mass_crawler_output.log" ]; then
tail -15 mass_crawler_output.log
else
echo "❌ Лог файл не найден"
fi
echo ""
echo "═══════════════════════════════════════════════════════════════"