Carousell new-listing monitor: NocoDB archive + Telegram alerts

This commit is contained in:
2026-09-02 08:25:12 +08:00
commit 17b7c4c55f
9 changed files with 604 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
"""Docker HEALTHCHECK: healthy iff a tick ran recently AND the last run was ok."""
import json
import os
import sys
import time
DATA_DIR = os.environ.get("DATA_DIR", "/data")
STALE = int(os.environ.get("HEALTH_STALE_SECONDS", "600"))
try:
with open(os.path.join(DATA_DIR, "health.json"), encoding="utf-8") as f:
h = json.load(f)
age = time.time() - int(h.get("last_run_epoch", 0))
if age <= STALE and h.get("ok") is True:
sys.exit(0)
except Exception:
pass
sys.exit(1)