douyinWEB/scripts/_count_b55f4b6_shortschannels.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

34 lines
930 B
Python

# -*- coding: utf-8 -*-
import paramiko
HOST = "107.173.30.245"
USER = "root"
PASSWORD = "Xiao4669805"
H = "b55f4b6"
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, 22, USER, PASSWORD, timeout=30, allow_agent=False, look_for_keys=False)
tmp = f"/tmp/monitor_{H}.db"
cmd = (
"cd /opt/douyinWEB && "
f"git show {H}:backend/data/monitor.db > {tmp} && "
"python3 -c \"import sqlite3; "
f"conn=sqlite3.connect('{tmp}'); "
"print(conn.execute('select count(*) from shorts_channels').fetchone()[0])\""
)
_stdin, stdout, stderr = c.exec_command(cmd, timeout=180)
out = stdout.read().decode('utf-8', 'replace')
err = stderr.read().decode('utf-8', 'replace')
print(out.strip())
if err.strip():
print('err:', err.strip())
c.close()
if __name__ == "__main__":
main()