Skip to content

Commit

Permalink
add in java custom args
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jul 22, 2024
1 parent 24b88b1 commit 2262f21
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ docker run -d \
-e JAVA_INITIAL_HEAP_SIZE=<java initial heap size in megabytes> \
-e JAVA_MAX_HEAP_SIZE=<java max heap size in megabytes> \
-e JAVA_MAX_THREADS=<java max number of threads> \
-e JAVA_CUSTOM_ARGS=<java custom arguments> \
-e STARTUP_CMD=<minecraft console command to execute on startup> \
-e UMASK=<umask for created files> \
-e PUID=<uid for user> \
Expand Down Expand Up @@ -65,6 +66,7 @@ docker run -d \
-e JAVA_INITIAL_HEAP_SIZE=512M \
-e JAVA_MAX_HEAP_SIZE=1024M \
-e JAVA_MAX_THREADS=1 \
-e JAVA_CUSTOM_ARGS='' \
-e STARTUP_CMD=gamerule reducedDebugInfo true \
-e UMASK=000 \
-e PUID=0 \
Expand Down
7 changes: 7 additions & 0 deletions build/root/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ else
export JAVA_MAX_THREADS="1"
fi
export JAVA_CUSTOM_ARGS=$(echo "${JAVA_CUSTOM_ARGS}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${JAVA_CUSTOM_ARGS}" ]]; then
echo "[info] JAVA_CUSTOM_ARGS defined as '${JAVA_CUSTOM_ARGS}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[info] JAVA_CUSTOM_ARGS not defined,(via -e JAVA_CUSTOM_ARGS)" | ts '%Y-%m-%d %H:%M:%.S'
fi
export STARTUP_CMD=$(echo "${STARTUP_CMD}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${STARTUP_CMD}" ]]; then
echo "[info] STARTUP_CMD defined as '${STARTUP_CMD}'" | ts '%Y-%m-%d %H:%M:%.S'
Expand Down
2 changes: 1 addition & 1 deletion run/nobody/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function start_minecraft() {
# run screen attached to minecraft (daemonized, non-blocking) to allow users to run commands in minecraft console
echo "[info] Starting Minecraft Java process..."
set -x
screen -L -Logfile '/config/minecraft/logs/screen.log' -d -S minecraft -m bash -c "cd /config/minecraft && java -Xms${JAVA_INITIAL_HEAP_SIZE} -Xmx${JAVA_MAX_HEAP_SIZE} -XX:ParallelGCThreads=${JAVA_MAX_THREADS} ${java_log4j_mitigation} -jar ${CUSTOM_JAR_PATH} nogui"
screen -L -Logfile '/config/minecraft/logs/screen.log' -d -S minecraft -m bash -c "cd /config/minecraft && java -Xms${JAVA_INITIAL_HEAP_SIZE} -Xmx${JAVA_MAX_HEAP_SIZE} -XX:ParallelGCThreads=${JAVA_MAX_THREADS} ${JAVA_CUSTOM_ARGS} ${java_log4j_mitigation} -jar ${CUSTOM_JAR_PATH} nogui"
set +x
echo "[info] Minecraft Java process is running"
if [[ ! -z "${STARTUP_CMD}" ]]; then
Expand Down

0 comments on commit 2262f21

Please sign in to comment.