File size: 392 Bytes
2c99b34
 
 
d781b80
2c99b34
 
 
 
d781b80
2c99b34
 
 
 
 
d781b80
0f4f34a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/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