Add MCSD_CLEAN_LOGS option

This commit is contained in:
JeremyStar™ 2024-01-26 14:37:52 +01:00
parent 6480a6036e
commit a404cb9395
2 changed files with 8 additions and 2 deletions

View file

@ -13,6 +13,7 @@ services:
- MCSD_FORCE_UPGRADE=true # updates all chunks to the latest version, if possible. will slow down startup time on upgrade but will significantly increase server performance during runtime - MCSD_FORCE_UPGRADE=true # updates all chunks to the latest version, if possible. will slow down startup time on upgrade but will significantly increase server performance during runtime
- MCSD_SAFEMODE=false # disables all datapacks - MCSD_SAFEMODE=false # disables all datapacks
- MCSD_AUTO_RESTART=true # restarts the server automatically if it exists - MCSD_AUTO_RESTART=true # restarts the server automatically if it exists
- MCSD_CLEAN_LOGS=true # removes all log files on startup (restarts are not affected)
- MCSD_JAVA_VERSION=17 # available arw: 17, 11 and 8 - MCSD_JAVA_VERSION=17 # available arw: 17, 11 and 8
ports: ports:
- 25565:25565 - 25565:25565

View file

@ -25,11 +25,15 @@ function initialize() {
export "ARGS=${ARGS}--safeMode " export "ARGS=${ARGS}--safeMode "
fi fi
if [ ! "${MCSD_AUTO_RESTART}" == "true" ] && [ ! "${MCSD_AUTO_RESTART}" == "false" ]; then if [ ! "${MCSD_AUTO_RESTART}" == "true" ] && [ ! "${MCSD_AUTO_RESTART}" == "false" ]; then
echo ":: Warning: No/Invalid auto restart value supplied, defaulting to false" echo ":: Warning: No/Invalid value supplied to \$MCSD_AUTO_RESTART, defaulting to false"
export "MCSD_AUTO_RESTART=false" export "MCSD_AUTO_RESTART=false"
fi fi
if [ ! "${MCSD_CLEAN_LOGS}" == "true" ] && [ ! "${MCSD_CLEAN_LOGS}" == "false" ]; then
echo ":: Warning: No/Invalid value supplied to \$MCSD_CLEAN_LOGS, defaulting to false"
export "MCSD_CLEAN_LOGS=false"
fi
if [ ! "${MCSD_JAVA_VERSION}" == "17" ] && [ ! "${MCSD_JAVA_VERSION}" == "11" ] && [ ! "${MCSD_JAVA_VERSION}" == "8" ]; then if [ ! "${MCSD_JAVA_VERSION}" == "17" ] && [ ! "${MCSD_JAVA_VERSION}" == "11" ] && [ ! "${MCSD_JAVA_VERSION}" == "8" ]; then
echo ":: Warning: No/Invalid java version supplied, defaulting to java version 17" echo ":: Warning: No/Invalid java version supplied to \$MCSD_JAVA_VERSION, defaulting to java version 17"
export "MCSD_JAVA_VERSION=17" export "MCSD_JAVA_VERSION=17"
fi fi
} }
@ -84,6 +88,7 @@ function main() {
initialize initialize
check check
accept_eula accept_eula
if [ "${MCSD_CLEAN_LOGS}" == "true" ]; then rm -rf "/data/logs"; fi
run run
} }