upgpkg: minecraft-server 1.10.2-3

* invoke SESSION_NAME when setting IDLE_SESSION_NAME
* make the destination of the game command dump configurable
* surpress error messages when sourcing since some variables might be
  set to read-only
master
Gordian Edenhofer 2016-08-04 12:51:07 +02:00
parent 271794e3ac
commit 82a539adb8
4 changed files with 15 additions and 10 deletions

View File

@ -28,7 +28,7 @@ pkgbase = minecraft-server
md5sums = b786935d6517d46fe0944377daba32b8
md5sums = fef6fadd0739ae03ff71ba61025be207
md5sums = afb84ad0316af0aca421b36eaa2bbd90
md5sums = 2cf2e3fe515be7c76da02256ab14abd4
md5sums = af6cd97b9b8d42f4fee75ed0bd0aa04a
md5sums = 025712e71efa4e21f625bddff28a2f15
md5sums = 1d7efd1c778c7866dcfe9628df847e58
pkgname = minecraft-server

View File

@ -26,8 +26,8 @@ md5sums=('41c4e081defd80b09cb0391c894c2f3c'
'b786935d6517d46fe0944377daba32b8'
'fef6fadd0739ae03ff71ba61025be207'
'afb84ad0316af0aca421b36eaa2bbd90'
'2cf2e3fe515be7c76da02256ab14abd4'
'af6cd97b9b8d42f4fee75ed0bd0aa04a')
'025712e71efa4e21f625bddff28a2f15'
'1d7efd1c778c7866dcfe9628df847e58')
_game="minecraft"
_server_root="/srv/minecraft"

View File

@ -20,7 +20,9 @@ SERVER_START_CMD="java -Xms512M -Xmx1024M -XX:ParallelGCThreads=1 -jar './${MAIN
# Describes whether a daemon process which stops the server if it is not used by a player
# within IDLE_IF_TIME seconds should be started. The GAME_PORT is not inhereted to the server!
IDLE_SERVER=false # true or false
IDLE_SESSION_NAME="idle_server"
# Ensure that if SESSION_NAME is passed through the command line and therefore set to read only by the script,
# IDLE_SESSION_NAME gets altered according to the command line and not the configurtion file, hence invoke the variable
IDLE_SESSION_NAME="${SESSION_NAME}_idle_server"
GAME_PORT="25565" # used to listen for incoming connections when the server is down
CHECK_PLAYER_TIME="30" # in seconds
IDLE_IF_TIME="1200" # in seconds

View File

@ -22,13 +22,16 @@ declare -r game="minecraft"
# System parameters for the control script
[[ ! -z "${IDLE_SERVER}" ]] && tmp_IDLE_SERVER=${IDLE_SERVER} || IDLE_SERVER="false"
[[ ! -z "${IDLE_SESSION_NAME}" ]] && declare -r IDLE_SESSION_NAME=${IDLE_SESSION_NAME} || IDLE_SESSION_NAME="idle_server"
[[ ! -z "${IDLE_SESSION_NAME}" ]] && declare -r IDLE_SESSION_NAME=${IDLE_SESSION_NAME} || IDLE_SESSION_NAME="${SESSION_NAME}_idle_server"
[[ ! -z "${GAME_PORT}" ]] && declare -r GAME_PORT=${GAME_PORT} || GAME_PORT="25565"
[[ ! -z "${CHECK_PLAYER_TIME}" ]] && declare -r CHECK_PLAYER_TIME=${CHECK_PLAYER_TIME} || CHECK_PLAYER_TIME="30"
[[ ! -z "${IDLE_IF_TIME}" ]] && declare -r IDLE_IF_TIME=${IDLE_IF_TIME} || IDLE_IF_TIME="1200"
# Additional configuration options which only few may need to alter
[[ ! -z "${GAME_COMMAND_DUMP}" ]] && declare -r GAME_COMMAND_DUMP=${GAME_COMMAND_DUMP} || GAME_COMMAND_DUMP="/tmp/${myname}_${SESSION_NAME}_command_dump.txt"
# Variables passed over the command line will always override the one from a config file
source /etc/conf.d/${game} || echo "Could not source /etc/conf.d/${game}"
source /etc/conf.d/${game} 2>/dev/null || >&2 echo "Could not source /etc/conf.d/${game}"
# Preserve the content of IDLE_SERVER without making it readonly
[[ ! -z ${tmp_IDLE_SERVER} ]] && IDLE_SERVER=${tmp_IDLE_SERVER}
@ -66,8 +69,8 @@ game_command() {
${SUDO_CMD} screen -S "${SESSION_NAME}" -X stuff "`printf \"$*\r\"`"
sleep ${sleep_time:-0.3}
${SUDO_CMD} screen -S "${SESSION_NAME}" -X log off
${SUDO_CMD} cat "/tmp/${myname}_screen_command_dump.txt"
${SUDO_CMD} rm "/tmp/${myname}_screen_command_dump.txt"
${SUDO_CMD} cat "${GAME_COMMAND_DUMP}"
${SUDO_CMD} rm "${GAME_COMMAND_DUMP}"
fi
}
@ -160,7 +163,7 @@ server_start() {
else
echo -en "Starting server..."
${SUDO_CMD} screen -dmS "${SESSION_NAME}" /bin/bash -c "cd '${SERVER_ROOT}'; ${SERVER_START_CMD}"
${SUDO_CMD} screen -S "${SESSION_NAME}" -X logfile "/tmp/${myname}_screen_command_dump.txt"
${SUDO_CMD} screen -S "${SESSION_NAME}" -X logfile "${GAME_COMMAND_DUMP}"
echo -e "\e[39;1m done\e[0m"
fi