Download start-services.sh from erdes/test1: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/erdes/test1/resolve/main/start-services.sh
- Command line
-
hf download hf://spaces/erdes/test1/start-services.sh
-
curl -L -o start-services.sh https://huggingface.co/spaces/erdes/test1/resolve/main/start-services.sh
1.26 kB
| set -e | |
| echo "===== VSCode Server Startup at $(date) =====" | |
| echo "Starting minimal services..." | |
| cd /home/user | |
| # 创建日志目录 | |
| mkdir -p /home/user/logs | |
| # 启动nginx | |
| echo "Starting nginx..." | |
| nginx -c /etc/nginx/nginx.conf & | |
| NGINX_PID=$! | |
| echo "Nginx started with PID: $NGINX_PID" | |
| # 等待nginx启动 | |
| sleep 2 | |
| # 启动code-server | |
| echo "Starting code-server..." | |
| code-server --config /home/user/.config/code-server/config.yaml & | |
| CODE_SERVER_PID=$! | |
| echo "Code-server started with PID: $CODE_SERVER_PID" | |
| # 等待code-server启动 | |
| sleep 3 | |
| # 启动cloudflare tunnel (如果有token) | |
| if [ ! -z "$TUNNEL_TOKEN" ]; then | |
| echo "Starting Cloudflare Tunnel with token..." | |
| cloudflared tunnel run --token $TUNNEL_TOKEN & | |
| TUNNEL_PID=$! | |
| echo "Cloudflare Tunnel started with PID: $TUNNEL_PID" | |
| else | |
| echo "No TUNNEL_TOKEN provided, starting Quick Tunnel..." | |
| cloudflared tunnel --url http://localhost:7860 & | |
| TUNNEL_PID=$! | |
| echo "Cloudflare Quick Tunnel started with PID: $TUNNEL_PID" | |
| fi | |
| echo "All services started successfully!" | |
| echo "Access URLs:" | |
| echo " - Code-server: http://localhost:7860" | |
| echo " - Nginx: http://localhost:8080" | |
| echo " - VSCode via Nginx: http://localhost:8080/admin-vscode" | |
| # 等待所有进程 | |
| wait |