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

39 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
"""Fix Neko black screen: browser-launch.sh not executable."""
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE = r"""
echo '4669805' | sudo -S -p '' bash -lc '
set -e
# host copy used as volume
for f in \
/opt/douyinWEB/backend/neko/browser-launch.sh \
/opt/douyinWEB/backend/data/neko/browser-launch.sh \
/etc/neko/browser-launch.sh
do
if [ -f "$f" ]; then chmod a+rx "$f"; ls -la "$f"; fi
done
# inside running container (bind mount may share host path)
docker exec -u root douyinweb-neko-1 sh -c "chmod a+rx /etc/neko/browser-launch.sh; ls -la /etc/neko/browser-launch.sh"
docker exec -u root douyinweb-neko-1 supervisorctl restart google-chrome || docker exec -u root douyinweb-neko-1 supervisorctl start google-chrome
sleep 3
docker exec douyinweb-neko-1 supervisorctl status
echo ===chrome procs===
docker exec douyinweb-neko-1 sh -c "for p in /proc/[0-9]*; do cmd=\$(tr \"\\0\" \" \" < \$p/cmdline 2>/dev/null); echo \$cmd; done" | grep -i chrom | head -10 || echo no_chrome
echo ===devtools===
docker exec douyinweb-neko-1 sh -c "curl -sS -m 2 http://127.0.0.1:9222/json/version 2>/dev/null | head -c 200 || echo no_devtools"
'
"""
g = paramiko.SSHClient()
g.set_missing_host_key_policy(paramiko.AutoAddPolicy())
g.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, banner_timeout=80, allow_agent=False, look_for_keys=False)
_, o, e = g.exec_command(REMOTE, timeout=90)
print((o.read() + e.read()).decode("utf-8", "replace"))
g.close()