homelab-brain/smart-home/scripts/cleanup-raspi-broker-tmp.py
Homelab Cursor d0b2c182de fix(ops): dokumentiere Smart-Home-Alert-Fixes und Matomo-Check
- Hausmeister-Bot Matomo-HTTP-Check korrigiert: Matomo laeuft in CT109
  (10.10.10.109), nicht in CT113.
- Smart-Home-Doku ergaenzt: CT143/raspi-broker Error-Rate war durch
  /tmp-tmpfs-Backups, vollen Swap und Telegraf-Noise verursacht.
- Cleanup-Script fuer alte raspi-broker-TARs versioniert, damit /tmp
  im CT143 nicht erneut RAM/Swap fuellt.
2026-04-25 14:50:16 +02:00

13 lines
391 B
Python

#!/usr/bin/env python3
from pathlib import Path
from time import time
# ioBroker/backitup legt temporaere raspi-broker-TARs in /tmp ab.
# /tmp ist tmpfs und belegt RAM; alte Archive muessen weg.
cutoff = time() - 36 * 3600
for p in Path('/tmp').glob('raspi-broker-*.tar.gz'):
try:
if p.stat().st_mtime < cutoff:
p.unlink()
except FileNotFoundError:
pass