diff --git a/README.md b/README.md index e785791..94b4de9 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ If you do **NOT** want world backups and/or purging of backups then set the valu Env var 'CUSTOM_JAR_PATH' is optional and allows you to define a specific jar to run, if not specified then the latest Mojang Minecraft jar will be used. +Env var 'CUSTOM_STARTUP_SCRIPT' is optional and allows you to run a specific sh script instead of a jar file + Env vars 'JAVA_INITIAL_HEAP_SIZE' value and 'JAVA_MAX_HEAP_SIZE' values must be a multiple of 1024 and greater than 2MB. User ID (PUID) and Group ID (PGID) can be found by issuing the following command for the user you want to run the container as:- @@ -90,4 +92,4 @@ If you appreciate my work, then please consider buying me a beer :D [![PayPal donation](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MM5E27UX6AUU4) -[Documentation](https://github.com/binhex/documentation) | [Support forum](https://forums.unraid.net/topic/84880-support-binhex-minecraftserver/) \ No newline at end of file +[Documentation](https://github.com/binhex/documentation) | [Support forum](https://forums.unraid.net/topic/84880-support-binhex-minecraftserver/) diff --git a/build/root/install.sh b/build/root/install.sh index bfd6ed3..6d072eb 100644 --- a/build/root/install.sh +++ b/build/root/install.sh @@ -43,7 +43,7 @@ fi #### # define pacman packages -pacman_packages="jre8-openjdk-headless jre11-openjdk-headless jre-openjdk-headless screen rsync" +pacman_packages="jre8-openjdk-headless jre11-openjdk-headless jre-openjdk-headless screen rsync which" # install compiled packages using pacman if [[ ! -z "${pacman_packages}" ]]; then diff --git a/run/nobody/start.sh b/run/nobody/start.sh index 055f7b6..5e85aaa 100644 --- a/run/nobody/start.sh +++ b/run/nobody/start.sh @@ -118,10 +118,18 @@ function start_minecraft() { # create logs sub folder to store screen output from console mkdir -p /config/minecraft/logs + # allow custom scripts instead of forced jar - useful to run modern modpacks + if [[ -z "${CUSTOM_STARTUP_SCRIPT}" ]]; then + run_script="java -Xms${JAVA_INITIAL_HEAP_SIZE} -Xmx${JAVA_MAX_HEAP_SIZE} -XX:ParallelGCThreads=${JAVA_MAX_THREADS} ${java_log4j_mitigation} -jar ${CUSTOM_JAR_PATH} nogui" + else + chmod +x "${CUSTOM_STARTUP_SCRIPT}" + run_script="${CUSTOM_STARTUP_SCRIPT}" + fi + # 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 && ${run_script}" set +x echo "[info] Minecraft Java process is running" if [[ ! -z "${STARTUP_CMD}" ]]; then