-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_sync.py
More file actions
executable file
·49 lines (38 loc) · 1.28 KB
/
quick_sync.py
File metadata and controls
executable file
·49 lines (38 loc) · 1.28 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
#!/usr/bin/env python3
"""
Quick Sync - Schneller Update ohne vollen Resync
Nur für bereits extrahierte Daten
"""
import os
import sys
import json
from datetime import datetime
from pathlib import Path
def quick_sync():
"""Schneller Sync der bereits extrahierten Daten"""
print("="*60)
print("🔄 Quick Sync - Update Calendar")
print("="*60)
# Prüfe ob Daten vorhanden
week_files = list(Path('weekly_data').glob('week_*.json'))
if not week_files:
print("\n⚠️ Keine Daten gefunden - führe vollen Sync aus")
print(" Verwende: ./run_full_sync.sh")
return 1
print(f"\n📁 {len(week_files)} Wochen-Dateien gefunden")
# Führe nur Sync aus (keine Extraktion)
os.chdir('/opt/UntisCalSync')
import subprocess
subprocess.run(['/opt/UntisCalSync/venv/bin/python3', 'sync_all_weeks.py'])
# Speichere letzten Sync-Zeitpunkt
status = {
'last_sync': datetime.now().isoformat(),
'next_sync': (datetime.now().timestamp() + 1800), # +30 Minuten
'status': 'success'
}
with open('sync_status.json', 'w') as f:
json.dump(status, f, indent=2)
print("\n✅ Quick Sync abgeschlossen!")
return 0
if __name__ == '__main__':
sys.exit(quick_sync())