cd /home/def/otb_billing || exit 1 set -e STAMP="$(date +%Y%m%d-%H%M%S)" cp templates/includes/otb_statusbar.html "templates/includes/otb_statusbar.html.bak.${STAMP}" 2>/dev/null || true cp templates/portal_login.html "templates/portal_login.html.bak.footer.${STAMP}" cp templates/portal_dashboard.html "templates/portal_dashboard.html.bak.footer.${STAMP}" 2>/dev/null || true cp templates/portal_set_password.html "templates/portal_set_password.html.bak.footer.${STAMP}" 2>/dev/null || true cp templates/portal_terms.html "templates/portal_terms.html.bak.footer.${STAMP}" 2>/dev/null || true cp templates/portal_invoice_detail.html "templates/portal_invoice_detail.html.bak.footer.${STAMP}" 2>/dev/null || true cp templates/portal_forgot_password.html "templates/portal_forgot_password.html.bak.footer.${STAMP}" 2>/dev/null || true cat > templates/includes/otb_footer.html <<'EOF' {% include "includes/otb_statusbar.html" %} EOF python3 <<'PY' from pathlib import Path import re files = [ Path("templates/portal_login.html"), Path("templates/portal_dashboard.html"), Path("templates/portal_set_password.html"), Path("templates/portal_terms.html"), Path("templates/portal_invoice_detail.html"), Path("templates/portal_forgot_password.html"), ] for p in files: if not p.exists(): continue text = p.read_text() text = re.sub( r'\{\%\s*include\s+"includes/otb_statusbar\.html"\s*\%\}\s*', '{% include "includes/otb_footer.html" %}', text, count=1, flags=re.S ) text = re.sub( r'\{\%\s*include\s+"includes/otb_statusbar\.html"\s*\%\}', '{% include "includes/otb_footer.html" %}', text, count=1, flags=re.S ) p.write_text(text) print(f"updated: {p}") PY sudo systemctl restart otb_billing