Add guarded bot recovery and daily restore-verified realm backups
Core tests / core (push) Successful in 1m48s

This commit is contained in:
Codex
2026-09-22 20:28:44 -04:00
parent 9ec0ef2b1b
commit 64fb329b2e
7 changed files with 411 additions and 0 deletions
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
from pathlib import Path
import shutil,subprocess
repo=Path(__file__).resolve().parents[2]
lab=Path.home()/'azerothai-pc-lab'
shutil.copy2(repo/'ale/azerothai_recovery.lua',lab/'azerothcore/azerothai-lua/azerothai_recovery.lua')
units=Path.home()/'.config/systemd/user';units.mkdir(parents=True,exist_ok=True)
python=shutil.which('python3');assert python
(units/'azerothai-backup.service').write_text(f'''[Unit]
Description=AzerothAI backup and isolated restore verification
[Service]
Type=oneshot
WorkingDirectory={repo}
ExecStart=/usr/bin/sg docker -c "{python} {repo}/scripts/realm-backup.py"
TimeoutStartSec=30min
Nice=10
UMask=0077
''')
(units/'azerothai-backup.timer').write_text('''[Unit]
Description=AzerothAI daily verified backup
[Timer]
OnCalendar=*-*-* 06:00:00 UTC
Persistent=true
RandomizedDelaySec=300
[Install]
WantedBy=timers.target
''')
subprocess.run(['systemctl','--user','daemon-reload'],check=True)
subprocess.run(['systemctl','--user','enable','--now','azerothai-backup.timer'],check=True)
print('Daily backup scheduled for 06:00 UTC; reload ALE to enable native recovery.')