Repository navigation
Expand file tree
/
Copy pathstart_server.sh
More file actions
35 lines (27 loc) · 2.21 KB
/
Copy pathstart_server.sh
File metadata and controls
35 lines (27 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
#
# Process plugin config templates to generate the config files with secrets
#
# Extract ENV_ARGS from app.json
ENV_ARGS=$(jq -r '.["env-args"] | join(" ")' ./app.json)
# Only call replace-env-vars.sh if ENV_ARGS is not empty
if [ -n "$ENV_ARGS" ]; then
echo "Processing config templates with args: $ENV_ARGS"
../Zrvr/scripts/internal/replace-env-vars.sh $ENV_ARGS
else
echo "No env args found, skipping template processing"
fi
# Get memory from env variable or use default value of 4GB
if [ -z "$MEMORY" ]; then
MEMORY=4G
echo "No memory limit set, using default value of 4GB"
fi
echo "Using memory limit of $MEMORY."
MEM_NUM=$(echo "$MEMORY" | sed 's/[^0-9]//g')
JAR_NAME=$(jq -r '.JAR_NAME' /app/app.json)
find /app \( -not -uid "$USER_ID" -o -not -gid "$USER_ID" \) -print0 | xargs -0 -r chown "$USER_ID":"$USER_ID"
if [ "$MEM_NUM" -gt 12 ]; then
exec gosu mc:mc mc-server-runner java -Xms"${MEMORY}" -Xmx"${MEMORY}" --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -jar "$JAR_NAME" --nogui
else
exec gosu mc:mc mc-server-runner java -Xms"${MEMORY}" -Xmx"${MEMORY}" --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -jar "$JAR_NAME" --nogui
fi