#!/usr/bin/env python3 from pathlib import Path import sys sys.path.insert(0, str(Path(__file__).resolve().parent)) import vps_ssh local = Path(__file__).resolve().parent / "_tmp_wo_hub_db_remote.py" vps_ssh.put(str(local), "/tmp/wo_hub_db.py") code, out = vps_ssh.run("python3 /tmp/wo_hub_db.py") print("DB code", code) print(out) code, out = vps_ssh.run("sudo -n /usr/local/sbin/otantik-wg show", sudo=False) if code != 0: code, out = vps_ssh.run("/usr/local/sbin/otantik-wg show", sudo=True) print("WG code", code) print(out) code, out = vps_ssh.run("ping -c 3 -W 3 10.88.0.6; echo EXIT:$?") print("PING", out) code, out = vps_ssh.run("timeout 6 bash -c 'echo >/dev/tcp/10.88.0.6/8728' && echo API_OPEN || echo API_FAIL") print("API", out)