OrbitMC commited on
Commit
b48ae4d
·
verified ·
1 Parent(s): 0851e07

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +16 -20
start.sh CHANGED
@@ -3,32 +3,28 @@ set -e
3
 
4
  echo "==== Server Initialization ===="
5
 
6
- # --- Data Setup ---
7
- echo ">> Loading world data..."
8
- if command -v python3 >/dev/null 2>&1 && [ -f "download_world.py" ]; then
9
- python3 download_world.py || echo "⚠️ Using default world"
10
- fi
11
-
12
- # --- Server Configuration ---
13
- echo ">> Setting up server environment..."
14
- echo "eula=true" > eula.txt
15
 
16
- if [ ! -f "server.properties" ]; then
17
- echo "Generating default server.properties..."
18
- echo "server-port=25565" > server.properties
 
19
  else
20
- sed -i "s/^server-port=.*/server-port=25565/" server.properties
21
- sed -i "s/^query.port=.*/query.port=25565/" server.properties
22
  fi
23
 
24
  chmod -R 777 /app 2>/dev/null || true
25
 
26
- # --- Start the Web UI & Panel ---
 
 
 
27
  echo "=========================================================="
28
- echo ">> Starting Professional Panel on Port 7860..."
29
- echo ">> Minecraft output will be suppressed here to stop spam."
30
- echo ">> Open the Hugging Face Space URL in your browser to access the Console and File Manager!"
31
  echo "=========================================================="
32
 
33
- # Run the python panel script
34
- exec python3 panel.py
 
3
 
4
  echo "==== Server Initialization ===="
5
 
6
+ # --- Server Configuration (runs instantly, no download here) ---
7
+ echo ">> Writing eula.txt and server.properties..."
8
+ echo "eula=true" > /app/eula.txt
 
 
 
 
 
 
9
 
10
+ if [ ! -f "/app/server.properties" ]; then
11
+ echo "server-port=25565" > /app/server.properties
12
+ echo "query.port=25565" >> /app/server.properties
13
+ echo "online-mode=false" >> /app/server.properties
14
  else
15
+ sed -i "s/^server-port=.*/server-port=25565/" /app/server.properties
16
+ sed -i "s/^query\.port=.*/query.port=25565/" /app/server.properties
17
  fi
18
 
19
  chmod -R 777 /app 2>/dev/null || true
20
 
21
+ # KEY FIX: Start the web panel FIRST so HuggingFace health-check passes.
22
+ # World download + Minecraft boot now happen as background async tasks
23
+ # inside panel.py's lifespan — the HTTP server is ready on port 7860
24
+ # before any slow download begins.
25
  echo "=========================================================="
26
+ echo ">> Starting Panel on port 7860 (world download will run"
27
+ echo " in background after the server is already listening)."
 
28
  echo "=========================================================="
29
 
30
+ exec python3 /app/panel.py