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

33 lines
1.3 KiB
Python

import paramiko
import time
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=15, allow_agent=False, look_for_keys=False)
def run(cmd, timeout=60):
_, out, err = c.exec_command(cmd, timeout=timeout)
return out.read().decode("utf-8", "replace").strip(), err.read().decode("utf-8", "replace").strip()
time.sleep(12)
print("api:", run("systemctl is-active douyinweb-api")[0])
o, e = run("cd /opt/douyinWEB/backend && .venv/bin/python -c \"from app import db; db.init_db(); print('init ok')\"")
print("init_db:", o or e)
o, e = run(
"python3 -c \"import sqlite3; c=sqlite3.connect('/opt/douyinWEB/backend/data/monitor.db'); "
"tables=[r[0] for r in c.execute(\\\"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'tiktok%'\\\").fetchall()]; "
"print('tables', tables); "
"print('channels', c.execute('SELECT COUNT(*) FROM tiktok_channels').fetchone()[0] if 'tiktok_channels' in tables else 'N/A')\""
)
print("tiktok:", o or e)
o, _ = run(
"python3 -c \"import sqlite3; c=sqlite3.connect('/opt/douyinWEB/backend/data/monitor.db'); "
"print('shorts_channels', c.execute('SELECT COUNT(*) FROM shorts_channels').fetchone()[0])\""
)
print("shorts:", o)
c.close()