douyinWEB/scripts/_check_server_git_db.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

49 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
import paramiko
HOST = "107.173.30.245"
USER = "root"
PASSWORD = "Xiao4669805"
def run(c: paramiko.SSHClient, cmd: str, timeout: int = 60) -> tuple[str, str]:
_stdin, stdout, stderr = c.exec_command(cmd, timeout=timeout)
out = stdout.read().decode("utf-8", "replace").strip()
err = stderr.read().decode("utf-8", "replace").strip()
return out, err
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)
cmds = [
("git status", "cd /opt/douyinWEB && git status --porcelain=v1"),
("git stash list", "cd /opt/douyinWEB && git stash list"),
("monitor.db stat", "ls -l /opt/douyinWEB/backend/data/monitor.db"),
(
"blacklist/rooms/sessions/events",
"python3 -c \"import sqlite3; conn=sqlite3.connect('/opt/douyinWEB/backend/data/monitor.db'); "
"print('blacklist', conn.execute('select count(*) from blacklist').fetchone()[0]); "
"print('rooms', conn.execute('select count(*) from rooms').fetchone()[0]); "
"print('sessions', conn.execute('select count(*) from sessions').fetchone()[0]); "
"print('events', conn.execute('select count(*) from events').fetchone()[0]);\"",
),
]
for title, cmd in cmds:
out, err = run(c, cmd, timeout=90)
print("\n==", title, "==")
print(out)
if err:
print("ERR:", err[:300])
c.close()
print("\nDONE")
if __name__ == "__main__":
main()