From 53bb3e07646e83182bac85584c0ea9a335139e32 Mon Sep 17 00:00:00 2001 From: Gordian Edenhofer Date: Wed, 11 May 2016 00:18:26 +0200 Subject: [PATCH] upgpkg: minecraft-server 1.9.4-1 Reset timer to ( IDLE_IF_TIME - 300 seconds [5 min.] ) on shutdown, so after pinging the server it will go down earlier instead of waiting the full IDLE_IF_TIME. This only affects the idle_server_daemon. --- .SRCINFO | 12 ++++++------ PKGBUILD | 8 ++++---- minecraftd.sh | 15 ++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 6614907..38ae185 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = minecraft-server pkgdesc = Minecraft server unit files, script, and jar - pkgver = 1.9.2 - pkgrel = 4 + pkgver = 1.9.4 + pkgrel = 1 url = http://minecraft.net/ install = minecraft-server.install arch = any @@ -14,19 +14,19 @@ pkgbase = minecraft-server optdepends = netcat: required in order to suspend an idle server conflicts = minecraft-server-systemd conflicts = minecraft-canary - noextract = minecraft_server.1.9.2.jar + noextract = minecraft_server.1.9.4.jar backup = etc/conf.d/minecraft - source = https://s3.amazonaws.com/Minecraft.Download/versions/1.9.2/minecraft_server.1.9.2.jar + source = https://s3.amazonaws.com/Minecraft.Download/versions/1.9.4/minecraft_server.1.9.4.jar source = minecraftd-backup.service source = minecraftd-backup.timer source = minecraftd.service source = minecraftd.conf source = minecraftd.sh - md5sums = 560d467028f17a70997151ed0053deb6 + md5sums = 292feb3085809e714da2ca75514b9d5b md5sums = b786935d6517d46fe0944377daba32b8 md5sums = fef6fadd0739ae03ff71ba61025be207 md5sums = afb84ad0316af0aca421b36eaa2bbd90 md5sums = 00045683c06924d765ac14887218ffcc - md5sums = 1f31f0e0ee859ed43b512121b61edc69 + md5sums = ae1a827fe7fa5ff62b1b5627d6850c82 pkgname = minecraft-server diff --git a/PKGBUILD b/PKGBUILD index aaf939d..0d4f191 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,8 +3,8 @@ # Contributer: sowieso pkgname=minecraft-server -pkgver=1.9.2 -pkgrel=4 +pkgver=1.9.4 +pkgrel=1 pkgdesc="Minecraft server unit files, script, and jar" arch=('any') url="http://minecraft.net/" @@ -22,12 +22,12 @@ source=("https://s3.amazonaws.com/Minecraft.Download/versions/${pkgver}/minecraf "minecraftd.conf" "minecraftd.sh") noextract=("minecraft_server.${pkgver}.jar") -md5sums=('560d467028f17a70997151ed0053deb6' +md5sums=('292feb3085809e714da2ca75514b9d5b' 'b786935d6517d46fe0944377daba32b8' 'fef6fadd0739ae03ff71ba61025be207' 'afb84ad0316af0aca421b36eaa2bbd90' '00045683c06924d765ac14887218ffcc' - '1f31f0e0ee859ed43b512121b61edc69') + 'ae1a827fe7fa5ff62b1b5627d6850c82') _game="minecraft" _server_root="/srv/minecraft" diff --git a/minecraftd.sh b/minecraftd.sh index abf35ea..e0a07aa 100755 --- a/minecraftd.sh +++ b/minecraftd.sh @@ -89,7 +89,7 @@ idle_server_daemon() { # and since playernames may not contain this string the clean player-list can be easily retrieved. if [[ $? -eq 0 && -z $(sleep 0.6; tail -n 1 "${LOGPATH}/latest.log" | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | sed 's/.*\: //' | tr -d '\n') ]]; then # No player was seen on the server through list - no_player=$((no_player + CHECK_PLAYER_TIME)) + no_player=$(( no_player + CHECK_PLAYER_TIME )) # Stop the game server if no player was active for at least ${IDLE_IF_TIME} if [[ "${no_player}" -ge "${IDLE_IF_TIME}" ]]; then IDLE_SERVER="false" ${myname} stop @@ -100,8 +100,8 @@ idle_server_daemon() { [[ $i -eq 100 ]] && echo -e "An \e[39;1merror\e[0m occurred while trying to reset the idle_server!" sleep 0.1 done - # Reset timer - no_player=0 + # Reset timer and give the player 300 seconds to connect after pinging + no_player=$(( IDLE_IF_TIME - 300 )) # Game server is down, listen on port ${GAME_PORT} for incoming connections echo "Netcat is listening on port ${GAME_PORT} for incoming connections..." ${NETCAT_CMD} -v -l -p ${GAME_PORT} @@ -109,11 +109,12 @@ idle_server_daemon() { IDLE_SERVER="false" ${myname} start fi elif [[ $? -eq 0 ]]; then + # Reset timer since there is an active player on the server no_player=0 fi else - # Reset timer - no_player=0 + # Reset timer and give the player 300 seconds to connect after pinging + no_player=$(( IDLE_IF_TIME - 300 )) # Game server is down, listen on port ${GAME_PORT} for incoming connections echo "Netcat is listening on port ${GAME_PORT} for incoming connections..." ${NETCAT_CMD} -v -l -p ${GAME_PORT} @@ -317,7 +318,7 @@ backup_restore() { i=1 for f in "${BACKUP_DEST}"/[0-9_.]*; do echo -e " \e[39;1m$i)\e[0m\t$f" - i=$((i+1)) + i=$(( i + 1 )) done echo -en "Restore backup number: " @@ -329,7 +330,7 @@ backup_restore() { n=1 for f in "${BACKUP_DEST}"/[0-9_.]*; do [[ ${n} -eq $user_choice ]] && FILE="$f" - n=$((n+1)) + n=$(( n + 1 )) done if [[ -z $FILE ]]; then >&2 echo -e "\e[39;1mFailed\e[0m to interpret your input. Please enter the digit of the presented options."