Download entrypoint.sh from a79520/webos: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/a79520/webos/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/a79520/webos/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/a79520/webos/resolve/main/entrypoint.sh
1.06 kB
| set -e | |
| # 1) 可选:下载证书(sid 由 HF Settings → Secrets 注入) | |
| if [ -n "$sid" ]; then | |
| echo "[entrypoint] sid 存在,尝试下载 certificate.json ..." | |
| wget -q "https://ewebos.tenfell.cn/php/api.php?module=channel&action=down&id=$sid" \ | |
| -O certificate.json || echo "[warn] 证书下载失败,继续启动" | |
| else | |
| echo "[entrypoint] sid 未设置,跳过证书下载(可在 Space Settings 里加 Secret sid)" | |
| fi | |
| # 2) 先把旧的/僵死进程清掉(按你原 restart 语义) | |
| kill "$(cat /webos/api/pid 2>/dev/null)" 2>/dev/null || true | |
| # 3) 启动 webos(你原逻辑是 sh restart.sh) | |
| # 如果 restart.sh 本身是 nohup+后台,那就用兼容写法让它至少跑起来 | |
| if [ -x ./restart.sh ]; then | |
| ./restart.sh | |
| else | |
| echo "找不到 ./restart.sh,pwd=$(pwd)"; exit 1 | |
| fi | |
| # 4) 把外网端口 7860 转到程序实际端口 8088(HF 只暴露 7860 出来) | |
| # - 如果 webos 支持改监听端口为 7860,你可以省掉 socat | |
| socat TCP-LISTEN:7860,fork,reuseaddr TCP:127.0.0.1:8088 & | |
| wait |