#!/bin/bash set -e python3 <<'PY' from pathlib import Path import re p = Path("app.py") text = p.read_text() pattern = re.compile( r"\n\s*# === KILL DEAD PENDING PAYMENT \(no txid \+ expired lock\) ===.*?" r'print\("\[dead pending cleanup error\]", e\)\n', re.DOTALL ) new_text, count = pattern.subn("\n", text, count=1) if count == 0: raise SystemExit("FAILED: broken dead-pending block not found") p.write_text(new_text) print("OK: removed broken dead-pending block") PY python3 -m py_compile app.py echo "PY_COMPILE_OK" sudo systemctl restart otb_billing sudo systemctl status otb_billing --no-pager -l