-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_status.sh
More file actions
executable file
·69 lines (59 loc) · 2.88 KB
/
check_status.sh
File metadata and controls
executable file
·69 lines (59 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Quick Status Check - Zeigt aktuellen Status an
echo "════════════════════════════════════════════════════════"
echo "🤖 Untis Calendar Sync - System Status"
echo "════════════════════════════════════════════════════════"
echo ""
# Crontab Status
echo "⏰ CRONTAB:"
crontab -l | grep -E "auto_sync|run_full_sync" | sed 's/^/ /'
echo ""
# Server Status
if pgrep -f status_server.py > /dev/null; then
PID=$(pgrep -f status_server.py)
echo "🌐 STATUS SERVER: ✅ Läuft (PID: $PID)"
echo " Dashboard: http://localhost:8080/dashboard"
echo " JSON API: http://localhost:8080/status"
else
echo "🌐 STATUS SERVER: ❌ Gestoppt"
echo " Starten: nohup python3 status_server.py > logs/status_server.log 2>&1 &"
fi
echo ""
# Sync Status
cd /opt/UntisCalSync
python3 status_api.py --json > /tmp/status.json 2>/dev/null
LAST_SYNC=$(python3 -c "import json; data=json.load(open('/tmp/status.json')); print(data.get('last_sync', 'Nie'))" 2>/dev/null || echo "Nie")
NEXT_SYNC=$(python3 -c "import json; data=json.load(open('/tmp/status.json')); print(data.get('next_sync', 'Unbekannt'))" 2>/dev/null || echo "Unbekannt")
WEEKS=$(python3 -c "import json; data=json.load(open('/tmp/status.json')); print(data.get('weeks_extracted', 0))" 2>/dev/null || echo "0")
LESSONS=$(python3 -c "import json; data=json.load(open('/tmp/status.json')); print(data.get('total_lessons', 0))" 2>/dev/null || echo "0")
echo "📊 SYNC STATUS:"
echo " Letzter Sync: $LAST_SYNC"
if [ "$NEXT_SYNC" != "Unbekannt" ] && [ "$NEXT_SYNC" != "null" ]; then
NEXT_TS=$(date -d "$NEXT_SYNC" +%s 2>/dev/null || echo "0")
NOW_TS=$(date +%s)
if [ "$NEXT_TS" != "0" ]; then
MINS_LEFT=$(( ($NEXT_TS - $NOW_TS) / 60 ))
if [ $MINS_LEFT -gt 0 ]; then
echo " Nächster in: $MINS_LEFT Minuten"
else
echo " Nächster in: überfällig"
fi
fi
fi
echo " Wochen: $WEEKS | Lessons: $LESSONS"
echo ""
# Letzte Log-Einträge
echo "📝 LETZTE LOGS:"
if [ -f logs/cron.log ]; then
tail -3 logs/cron.log | sed 's/^/ /'
else
echo " Noch keine Logs vorhanden"
fi
echo ""
echo "════════════════════════════════════════════════════════"
echo "💡 Befehle:"
echo " Status: python3 status_api.py"
echo " Dashboard: xdg-open http://localhost:8080/dashboard"
echo " Quick-Sync: python3 quick_sync.py"
echo " Full-Sync: ./run_full_sync.sh"
echo "════════════════════════════════════════════════════════"