douyinWEB/scripts/_insp_nomadro_live.py
2026-09-13 22:10:49 -05:00

45 lines
1.5 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Inspect and start nomadro.live Next.js only (no WP router)."""
from __future__ import annotations
import sys
from pathlib import Path
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE = r"""#!/bin/bash
set -e
echo '=== units ==='
systemctl cat nomadro-live-router.service 2>/dev/null | head -40 || true
systemctl cat tiktok-promo-frontend.service 2>/dev/null | head -50 || true
ls /etc/systemd/system/*promo* /etc/systemd/system/*live* 2>/dev/null || true
echo '=== caddy nomadro.live ==='
cat /etc/caddy/sites/nomadro.live.caddy 2>/dev/null || true
grep -n 'nomadro.live\|3015\|4404\|8089' /etc/caddy/Caddyfile /etc/caddy/sites/*.caddy 2>/dev/null | head -40
echo '=== status before ==='
systemctl is-active nomadro-live-router.service tiktok-promo-frontend.service 2>/dev/null || true
ss -lntp | grep -E ':3015|:4404|:8089' || true
curl -sS -m 8 -o /dev/null -w 'public_before=%{http_code}\n' -L https://nomadro.live/ || true
"""
def main() -> int:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False)
sftp = c.open_sftp()
with sftp.file("/tmp/_insp_live.sh", "w") as f:
f.write(REMOTE)
sftp.close()
_, o, e = c.exec_command("bash /tmp/_insp_live.sh", timeout=60)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())