80 lines
3.1 KiB
Bash
Executable File
80 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Monitor CTF_Carstuff Local Structure Progress
|
|
# Author: Descomplicar® Crescimento Digital
|
|
# Link: https://descomplicar.pt
|
|
# Copyright: 2025 Descomplicar®
|
|
|
|
OUTPUT_DIR="/media/ealmeida/Dados/GDrive/Cloud/Clientes_360/CTF_Carstuff/KB/Scrapper/sites/formatted_local_test"
|
|
LOG_FILE="structure_local_execution.log"
|
|
|
|
clear
|
|
echo "═══════════════════════════════════════════════════════════════"
|
|
echo " 🚀 CTF_CARSTUFF - MONITOR ESTRUTURAÇÃO LOCAL (GRATUITO)"
|
|
echo " Método: Regex/Heurísticas | Qualidade: 2-3/5"
|
|
echo "═══════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
|
|
# Verificar se processo está a correr
|
|
if pgrep -f "structure_content_local.py" > /dev/null; then
|
|
echo "✅ Status: ATIVO (processamento local)"
|
|
echo ""
|
|
else
|
|
echo "⚠️ Status: CONCLUÍDO ou PARADO"
|
|
echo ""
|
|
fi
|
|
|
|
# Contar ficheiros
|
|
MD_COUNT=$(find "$OUTPUT_DIR" -type f -name "structured_*.md" 2>/dev/null | wc -l)
|
|
JSON_COUNT=$(find "$OUTPUT_DIR" -type f -name "structured_*.json" 2>/dev/null | wc -l)
|
|
TOTAL_SIZE=$(du -sh "$OUTPUT_DIR" 2>/dev/null | cut -f1)
|
|
|
|
echo "📊 Progresso Atual:"
|
|
echo " • Ficheiros MD estruturados: $MD_COUNT / 444"
|
|
echo " • Ficheiros JSON gerados: $JSON_COUNT / 444"
|
|
echo " • Tamanho total: $TOTAL_SIZE"
|
|
echo ""
|
|
|
|
# Calcular percentagem
|
|
if [ $MD_COUNT -gt 0 ]; then
|
|
PERCENT=$((MD_COUNT * 100 / 444))
|
|
echo " 🎯 Progresso: $PERCENT%"
|
|
echo ""
|
|
fi
|
|
|
|
# Tempo estimado (muito mais rápido - sem API)
|
|
if [ $MD_COUNT -gt 0 ]; then
|
|
REMAINING=$((444 - MD_COUNT))
|
|
SECONDS=$((REMAINING * 2)) # ~2s por ficheiro (regex)
|
|
MINUTES=$((SECONDS / 60))
|
|
echo " ⏱️ Tempo estimado restante: ${MINUTES}m"
|
|
echo ""
|
|
fi
|
|
|
|
# Últimos ficheiros processados
|
|
echo "📝 Últimas atividades:"
|
|
tail -15 "$LOG_FILE" 2>/dev/null | grep -E "(Processando|✅|❌)" | tail -10 | sed 's/^/ /'
|
|
echo ""
|
|
|
|
# Estatísticas de sucesso/erro
|
|
SUCESSOS=$(grep -c "✅" "$LOG_FILE" 2>/dev/null)
|
|
ERROS=$(grep -c "❌" "$LOG_FILE" 2>/dev/null)
|
|
|
|
echo "📈 Estatísticas:"
|
|
echo " • Sucessos: $SUCESSOS"
|
|
echo " • Erros: $ERROS"
|
|
if [ $SUCESSOS -gt 0 ]; then
|
|
TAXA=$((SUCESSOS * 100 / (SUCESSOS + ERROS + 1)))
|
|
echo " • Taxa de sucesso: ${TAXA}%"
|
|
fi
|
|
echo ""
|
|
|
|
echo "═══════════════════════════════════════════════════════════════"
|
|
echo "⚠️ NOTA: Qualidade esperada 2-3/5 (regex local)"
|
|
echo " Ficheiros podem ser reprocessados depois com Claude se necessário"
|
|
echo ""
|
|
echo "Comandos úteis:"
|
|
echo " • Ver log: tail -f structure_local_execution.log"
|
|
echo " • Ver ficheiros: ls -lh $OUTPUT_DIR"
|
|
echo " • Parar: pkill -f structure_content_local.py"
|
|
echo "═══════════════════════════════════════════════════════════════"
|