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>
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys, paramiko
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
|
def run(cmd):
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
return (o.read()+e.read()).decode("utf-8","replace").strip()
|
|
print(run(r"""cd /opt/douyinWEB/backend && .venv/bin/python -c "
|
|
from app import db, x_clips_db as xdb
|
|
from app.timeutil import push_date_from_ts
|
|
import time
|
|
db.init_db()
|
|
from app.db import _connect, _lock
|
|
day = push_date_from_ts(time.time())
|
|
print('push_date:', day)
|
|
with _lock:
|
|
conn = _connect()
|
|
try:
|
|
xdb.ensure_x_clips_tables(conn)
|
|
rows = conn.execute('SELECT status, COUNT(*) AS c FROM x_clip_jobs WHERE push_date=? GROUP BY status', (day,)).fetchall()
|
|
print('today:', {r['status']:r['c'] for r in rows})
|
|
recent = conn.execute('SELECT id,status,tweet_id,x2_job_id,attempts,updated_at,finished_at,push_date FROM x_clip_jobs ORDER BY updated_at DESC LIMIT 15').fetchall()
|
|
for r in recent:
|
|
d = dict(r)
|
|
print(d)
|
|
finally:
|
|
conn.close()
|
|
" """))
|
|
c.close()
|