Added CONSOLE envvar to control console output

By default, CONSOLE is true. When set to false, start-minecraft.sh
adds "--noconsole" to java. Use this to keep Spigot from burning CPU.
This commit is contained in:
Kirk Strauser 2016-09-22 06:56:29 -07:00
parent 4c0f24613c
commit aa13deecdb
2 changed files with 8 additions and 2 deletions

View File

@ -40,4 +40,4 @@ ENV UID=1000 GID=1000 \
MOTD="A Minecraft Server Powered by Docker" \
JVM_OPTS="-Xmx1024M -Xms1024M" \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= ONLINE_MODE=TRUE CONSOLE=true

View File

@ -441,10 +441,16 @@ if [ "$TYPE" = "SPIGOT" ]; then
fi
fi
if [[ $CONSOLE = false ]]; then
EXTRA_ARGS=--noconsole
else
EXTRA_ARGS=""
fi
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ];
then
exec java $JVM_OPTS -jar $SERVER "$@" < /data/bootstrap.txt
exec java $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS < /data/bootstrap.txt
else
exec java $JVM_OPTS -jar $SERVER "$@"
fi