douyinWEB/scripts/_jump_deploy_excl_dy.py
eric c1f3bd3c57 Fix exclusive sticky when Douyin probe says offline (status=4).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 06:03:46 -05:00

30 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
import sys
import 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=40, allow_agent=False, look_for_keys=False)
cmd = r"""
set -e
export SSHPASS='Xiao4669805'
command -v sshpass >/dev/null || apt-get install -y sshpass >/dev/null
sshpass -e scp -o StrictHostKeyChecking=no /tmp/youtube_relay_pipeline.py root@108.174.50.68:/opt/douyinWEB/backend/app/youtube_relay_pipeline.py
sshpass -e scp -o StrictHostKeyChecking=no /tmp/test_relay_normal_auto.py root@108.174.50.68:/opt/douyinWEB/backend/tests/test_relay_normal_auto.py
sshpass -e ssh -o StrictHostKeyChecking=no root@108.174.50.68 bash -s <<'EOS'
systemctl restart douyinweb-api
for i in $(seq 1 20); do
c=$(curl -sS -m 3 -o /dev/null -w '%{http_code}' http://127.0.0.1:8014/api/health || echo x)
echo health_$i=$c
[ "$c" = "200" ] && break
sleep 2
done
systemctl is-active douyinweb-api
EOS
"""
_, o, e = c.exec_command(cmd, timeout=180)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()