56 lines
1.6 KiB
Bash
Executable File
56 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# PROGRESS REPORT - Writes status to father-messages
|
|
|
|
WORK_QUEUE=/root/wizards/allegro/WORK-QUEUE.md
|
|
REPORT_DIR=/root/wizards/allegro/father-messages
|
|
REPORT_FILE=${REPORT_DIR}/progress-$(date +%Y%m%d-%H%M).txt
|
|
|
|
mkdir -p $REPORT_DIR
|
|
|
|
# Count tasks by looking for status lines
|
|
PENDING=$(grep -c '^\*\*Status:\*\* PENDING' $WORK_QUEUE 2>/dev/null | head -1 || echo 0)
|
|
IN_PROGRESS=$(grep -c 'IN_PROGRESS' $WORK_QUEUE 2>/dev/null | head -1 || echo 0)
|
|
COMPLETE=$(grep -c '^\*\*Status:\*\* COMPLETE' $WORK_QUEUE 2>/dev/null | head -1 || echo 0)
|
|
|
|
TOTAL=$((PENDING + IN_PROGRESS + COMPLETE))
|
|
|
|
if [ "$TOTAL" -gt 0 ] 2>/dev/null; then
|
|
PERCENT=$((COMPLETE * 100 / TOTAL))
|
|
else
|
|
PERCENT=0
|
|
fi
|
|
|
|
# Get list of task names
|
|
PENDING_TASKS=$(grep -B2 '^\*\*Status:\*\* PENDING' $WORK_QUEUE 2>/dev/null | grep '^### TASK-' | head -3)
|
|
ACTIVE_TASKS=$(grep -B2 'IN_PROGRESS' $WORK_QUEUE 2>/dev/null | grep '^### TASK-' | head -3)
|
|
|
|
# Write report
|
|
cat > $REPORT_FILE << EOF
|
|
PROGRESS REPORT - $(date)
|
|
========================
|
|
|
|
Queue Status:
|
|
- Pending: $PENDING
|
|
- In Progress: $IN_PROGRESS
|
|
- Complete: $COMPLETE
|
|
- Total: $TOTAL
|
|
- Progress: ${PERCENT}%
|
|
|
|
Pending Tasks:
|
|
$PENDING_TASKS
|
|
|
|
Active Tasks:
|
|
$ACTIVE_TASKS
|
|
|
|
Recent Completions:
|
|
$(ls -1t ${ALLEGRO_WORKSPACE}/completed/*.txt 2>/dev/null | head -3 | xargs -I {} basename {} 2>/dev/null)
|
|
|
|
---
|
|
Auto-generated by cron every 30 minutes
|
|
EOF
|
|
|
|
# Update latest report
|
|
cp $REPORT_FILE ${REPORT_DIR}/LATEST-PROGRESS.txt 2>/dev/null || true
|
|
|
|
echo "[$(date)] Progress report written: $REPORT_FILE" >> /root/wizards/allegro/logs/task-monitor.log
|