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

53 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import sys
import time
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
PASS = "4669805"
REMOTE = r"""
import sqlite3, subprocess
con=sqlite3.connect("/opt/douyinWEB/backend/data/monitor.db")
con.row_factory=sqlite3.Row
print("nomdfs yt_long", [dict(r) for r in con.execute(
"SELECT id,name,enabled FROM yt_long_channels WHERE name LIKE '%nomdfs%'")])
print("asian n", con.execute(
"SELECT count(*) FROM shorts_channels WHERE youtube_channel_id='UCjQ8jnBm2N4FGRowNXcXThw'").fetchone()[0])
print("orphan gone", con.execute(
"SELECT count(*) FROM yt_long_channels WHERE id='cf0c1355-7586-418c-927a-df4762de5774'").fetchone()[0])
print("evan orphan gone", con.execute(
"SELECT count(*) FROM yt_long_channels WHERE id='08a7a072-8c98-43ea-8488-b1db971c5d27'").fetchone()[0])
out=subprocess.check_output(
["systemctl","show","douyinweb-api","-p","Environment","--value"], text=True, errors="replace")
print("neko env", [p for p in out.split() if p.startswith("DY_NEKO_")])
"""
def main():
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(
"107.173.30.245",
4014,
"eric",
PASS,
timeout=60,
banner_timeout=120,
allow_agent=False,
look_for_keys=False,
)
sftp = c.open_sftp()
with sftp.file("/tmp/_v2.py", "w") as f:
f.write(REMOTE)
sftp.close()
_, o, e = c.exec_command(f"echo '{PASS}' | sudo -S -p '' python3 /tmp/_v2.py", timeout=60)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()
if __name__ == "__main__":
main()