#!/bin/sh # HF Space 入口点:清理所有旧 node 进程后启动 supervisord echo "[entrypoint] Cleaning up old node processes..." # 杀掉所有非当前 shell 的 node 进程 for pid in $(pgrep -x node 2>/dev/null); do echo "[entrypoint] Killing node PID $pid" kill -9 "$pid" 2>/dev/null done # 也杀掉可能残留的 kb-worker 进程 for pid in $(pgrep -f 'kb-worker' 2>/dev/null); do if [ "$pid" != "$$" ]; then echo "[entrypoint] Killing kb-worker PID $pid" kill -9 "$pid" 2>/dev/null fi done echo "[entrypoint] Cleanup done, starting supervisord..." exec supervisord -c /etc/supervisor/conf.d/app.conf -n