mc: apply INIT/MAX RAM settings into FTB local settings file

fixes #222
This commit is contained in:
Geoff Bourne
2018-07-13 16:35:56 -05:00
parent 2a1fba1b45
commit a95bfdb192
2 changed files with 28 additions and 7 deletions

View File

@@ -73,8 +73,7 @@ if [[ ${GUI} = false || ${GUI} = FALSE ]]; then
fi
# put these prior JVM_OPTS at the end to give any memory settings there higher precedence
echo "Setting initial memory to ${INIT_MEMORY:-${MEMORY}} and max to ${MAX_MEMORY:-${MEMORY}}"
JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS}"
echo "Setting initial memory to ${INIT_MEMORY:=${MEMORY}} and max to ${MAX_MEMORY:=${MEMORY}}"
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
if [ ! -e ${FTB_DIR}/ops.json -a -e /data/ops.txt ]; then
@@ -89,14 +88,20 @@ if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
cp -f /data/eula.txt ${FTB_DIR}/
fi
cat > ${FTB_DIR}/settings-local.sh <<EOF
export MIN_RAM="${INIT_MEMORY}"
export MAX_RAM="${MAX_MEMORY}"
EOF
cd ${FTB_DIR}
echo "Running FTB server modpack start ..."
exec mc-server-runner ${FTB_SERVER_START}
else
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ]; then
bootstrapArgs="--bootstrap /data/bootstrap.txt"
fi
# If we have a bootstrap.txt file... feed that in to the server stdin
if [ -f /data/bootstrap.txt ]; then
bootstrapArgs="--bootstrap /data/bootstrap.txt"
fi
exec mc-server-runner ${bootstrapArgs} java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
exec mc-server-runner ${bootstrapArgs} java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
fi