49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
REMOTE = r"""
|
|
set -e
|
|
echo '=== env ==='
|
|
grep -E 'DY_PUBLIC|PUBLIC_BASE|NEKO' /opt/douyinWEB/backend/.env 2>/dev/null | head -30 || true
|
|
systemctl show douyinweb-api -p Environment 2>/dev/null | tr ' ' '\n' | grep -E 'DY_PUBLIC|PUBLIC_BASE|NEKO' | head -30 || true
|
|
ls /etc/systemd/system/douyinweb-api.service.d 2>/dev/null || true
|
|
echo '=== python ==='
|
|
cd /opt/douyinWEB/backend
|
|
PY=python3
|
|
[ -x .venv/bin/python ] && PY=.venv/bin/python
|
|
$PY - <<'PY'
|
|
import os, sys
|
|
sys.path.insert(0, ".")
|
|
from app.config import settings
|
|
from app import youtube_neko
|
|
print("settings.public_base_url", repr(settings.public_base_url))
|
|
print("env DY_PUBLIC", repr(os.environ.get("DY_PUBLIC_BASE_URL")))
|
|
print("_public_base", repr(youtube_neko._public_base()))
|
|
print("physical_dual", youtube_neko._physical_dual_edge())
|
|
print("preferred", repr(youtube_neko.preferred_neko_public_base()))
|
|
print("studio6", youtube_neko.public_studio_url(6))
|
|
print("studio8", youtube_neko.public_studio_url(8))
|
|
PY
|
|
"""
|
|
|
|
|
|
def main() -> None:
|
|
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/_diag_neko_url.sh", "wb") as f:
|
|
f.write(REMOTE.encode())
|
|
sftp.close()
|
|
_i, o, e = c.exec_command("bash /tmp/_diag_neko_url.sh", timeout=60)
|
|
print((o.read() + e.read()).decode("utf-8", "replace"))
|
|
c.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|