From a404cb9395cc76edbfd882a2b6ca080581b4b751 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Fri, 26 Jan 2024 14:37:52 +0100 Subject: [PATCH] Add MCSD_CLEAN_LOGS option --- docker-compose.yml | 1 + entrypoint.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0114218..ca8a82b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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_SAFEMODE=false # disables all datapacks - 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 ports: - 25565:25565 diff --git a/entrypoint.sh b/entrypoint.sh index 6adbf2e..71f782e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -25,11 +25,15 @@ function initialize() { export "ARGS=${ARGS}--safeMode " fi 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" 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 - 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" fi } @@ -84,6 +88,7 @@ function main() { initialize check accept_eula + if [ "${MCSD_CLEAN_LOGS}" == "true" ]; then rm -rf "/data/logs"; fi run }