Tokipo commited on
Commit
facd5fe
·
verified ·
1 Parent(s): d58006d

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +64 -0
start.sh ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "==== Server Initialization ===="
5
+
6
+ # --- Server Configuration ---
7
+ echo ">> Setting up server environment..."
8
+
9
+ if [ -f "server.properties" ]; then
10
+ sed -i "s/^server-port=.*/server-port=7860/" server.properties
11
+ sed -i "s/^query.port=.*/query.port=7860/" server.properties
12
+ echo "✅ Port configured: 7860"
13
+ else
14
+ echo "⚠️ Using default configuration"
15
+ fi
16
+
17
+ # --- Data Setup ---
18
+ echo ">> Loading world data..."
19
+ if command -v python3 >/dev/null 2>&1 && [ -f "download_world.py" ]; then
20
+ python3 download_world.py || echo "⚠️ Using default world"
21
+ else
22
+ echo "ℹ️ No custom data found"
23
+ fi
24
+
25
+ chmod -R 777 /app/world* 2>/dev/null || true
26
+ chmod -R 777 /app/plugins 2>/dev/null || true
27
+
28
+ echo "Available data folders:"
29
+ ls -la /app/ | grep world || echo "No custom data - generating new"
30
+
31
+ # --- Start Main Service ---
32
+ echo ">> Starting main service on port 7860..."
33
+ echo ">> Java: $(java -version 2>&1 | head -n 1)"
34
+ echo ">> Memory: 8GB allocated"
35
+ echo ">> CPU: Optimized for 2 cores with fast world generation"
36
+
37
+ exec java -server -Xmx8G -Xms8G \
38
+ -XX:+UseG1GC \
39
+ -XX:+ParallelRefProcEnabled \
40
+ -XX:ParallelGCThreads=2 \
41
+ -XX:ConcGCThreads=1 \
42
+ -XX:MaxGCPauseMillis=50 \
43
+ -XX:+UnlockExperimentalVMOptions \
44
+ -XX:+DisableExplicitGC \
45
+ -XX:+AlwaysPreTouch \
46
+ -XX:G1NewSizePercent=30 \
47
+ -XX:G1MaxNewSizePercent=50 \
48
+ -XX:G1HeapRegionSize=16M \
49
+ -XX:G1ReservePercent=15 \
50
+ -XX:G1HeapWastePercent=5 \
51
+ -XX:G1MixedGCCountTarget=3 \
52
+ -XX:InitiatingHeapOccupancyPercent=10 \
53
+ -XX:G1MixedGCLiveThresholdPercent=90 \
54
+ -XX:G1RSetUpdatingPauseTimePercent=5 \
55
+ -XX:SurvivorRatio=32 \
56
+ -XX:+PerfDisableSharedMem \
57
+ -XX:MaxTenuringThreshold=1 \
58
+ -XX:G1SATBBufferEnqueueingThresholdPercent=30 \
59
+ -XX:G1ConcMarkStepDurationMillis=5 \
60
+ -XX:G1ConcRSHotCardLimit=16 \
61
+ -XX:+UseStringDeduplication \
62
+ -Dfile.encoding=UTF-8 \
63
+ -Dcom.mojang.eula.agree=true \
64
+ -jar purpur.jar --nogui