gl / run.sh
jxdn123's picture
Update run.sh
d781b80 verified
raw
history blame
392 Bytes
#!/usr/bin/env sh
set -e
# 启动后端(项目默认监听 :3001)
/app/gpt-load &
APP_PID=$!
# 若 HF 注入的 $PORT 不是 3001,用 socat 转发 $PORT -> 3001
if [ "${PORT:-7860}" != "3001" ]; then
echo "Forwarding :$PORT -> :3001 via socat"
socat TCP-LISTEN:${PORT},fork,reuseaddr TCP:127.0.0.1:3001 &
fi
# 等待后端进程结束(将退出码传递出去)
wait $APP_PID