douyinWEB/scripts/_stop_dy_neko2_accidental.py
2026-09-13 22:10:49 -05:00

37 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Stop dy neko-2 we accidentally started during verify; leave prior runner alone."""
from __future__ import annotations
import sys
import time
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(
"108.174.50.68",
22,
"root",
"Xiao4669805",
timeout=50,
allow_agent=False,
look_for_keys=False,
banner_timeout=180,
)
_i, o, e = c.exec_command(
r"""
set +e
# Only stop if we just brought it up for TM check and nothing critical needs it.
# Operator had it Exited; restore that. Do NOT recreate.
docker stop douyinweb-neko-2 2>/dev/null || true
docker ps --filter name=douyinweb-neko --format '{{.Names}} {{.Status}}' | sort -V
SEED='/opt/douyinWEB/backend/neko/tampermonkey-seed/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo'
echo -n 'dy_seed_markers='; grep -a -R -c 'YouTube Studio Auto Dismiss' "$SEED" 2>/dev/null | awk -F: '{s+=$2} END{print s+0}'
""",
timeout=60,
)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()