Files
wevads-platform/scripts/bcg_relay.py
2026-02-26 04:53:11 +01:00

13 lines
643 B
Python

#!/usr/bin/env python3
"""Relay to OVH BCG sender via SSH. Usage: python3 bcg_relay.py <json_file>"""
import sys,subprocess,base64,json
with open(sys.argv[1]) as f:
data=f.read()
b64=base64.b64encode(data.encode()).decode()
ssh_cmd=f'echo {b64} | base64 -d > /tmp/relay.json && python3 /home/ubuntu/wevads/bcg_send.py /tmp/relay.json 2>&1'
r=subprocess.run(["sshpass","-p","MX8D3zSAty7k3243242","ssh","-o","StrictHostKeyChecking=no","-o","ConnectTimeout=10","ubuntu@151.80.235.110",ssh_cmd],capture_output=True,text=True,timeout=30)
out=r.stdout.strip()
print(out if out else f"FAIL:{r.stderr.strip()}")
sys.exit(0 if "OK" in out else 1)