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.
This commit is contained in:
Gordian Edenhofer 2016-05-11 00:18:26 +02:00
parent 3fc4b8ae1d
commit 53bb3e0764
3 changed files with 18 additions and 17 deletions

View File

@ -1,7 +1,7 @@
pkgbase = minecraft-server pkgbase = minecraft-server
pkgdesc = Minecraft server unit files, script, and jar pkgdesc = Minecraft server unit files, script, and jar
pkgver = 1.9.2 pkgver = 1.9.4
pkgrel = 4 pkgrel = 1
url = http://minecraft.net/ url = http://minecraft.net/
install = minecraft-server.install install = minecraft-server.install
arch = any arch = any
@ -14,19 +14,19 @@ pkgbase = minecraft-server
optdepends = netcat: required in order to suspend an idle server optdepends = netcat: required in order to suspend an idle server
conflicts = minecraft-server-systemd conflicts = minecraft-server-systemd
conflicts = minecraft-canary conflicts = minecraft-canary
noextract = minecraft_server.1.9.2.jar noextract = minecraft_server.1.9.4.jar
backup = etc/conf.d/minecraft 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.service
source = minecraftd-backup.timer source = minecraftd-backup.timer
source = minecraftd.service source = minecraftd.service
source = minecraftd.conf source = minecraftd.conf
source = minecraftd.sh source = minecraftd.sh
md5sums = 560d467028f17a70997151ed0053deb6 md5sums = 292feb3085809e714da2ca75514b9d5b
md5sums = b786935d6517d46fe0944377daba32b8 md5sums = b786935d6517d46fe0944377daba32b8
md5sums = fef6fadd0739ae03ff71ba61025be207 md5sums = fef6fadd0739ae03ff71ba61025be207
md5sums = afb84ad0316af0aca421b36eaa2bbd90 md5sums = afb84ad0316af0aca421b36eaa2bbd90
md5sums = 00045683c06924d765ac14887218ffcc md5sums = 00045683c06924d765ac14887218ffcc
md5sums = 1f31f0e0ee859ed43b512121b61edc69 md5sums = ae1a827fe7fa5ff62b1b5627d6850c82
pkgname = minecraft-server pkgname = minecraft-server

View File

@ -3,8 +3,8 @@
# Contributer: sowieso <sowieso@dukun.de> # Contributer: sowieso <sowieso@dukun.de>
pkgname=minecraft-server pkgname=minecraft-server
pkgver=1.9.2 pkgver=1.9.4
pkgrel=4 pkgrel=1
pkgdesc="Minecraft server unit files, script, and jar" pkgdesc="Minecraft server unit files, script, and jar"
arch=('any') arch=('any')
url="http://minecraft.net/" url="http://minecraft.net/"
@ -22,12 +22,12 @@ source=("https://s3.amazonaws.com/Minecraft.Download/versions/${pkgver}/minecraf
"minecraftd.conf" "minecraftd.conf"
"minecraftd.sh") "minecraftd.sh")
noextract=("minecraft_server.${pkgver}.jar") noextract=("minecraft_server.${pkgver}.jar")
md5sums=('560d467028f17a70997151ed0053deb6' md5sums=('292feb3085809e714da2ca75514b9d5b'
'b786935d6517d46fe0944377daba32b8' 'b786935d6517d46fe0944377daba32b8'
'fef6fadd0739ae03ff71ba61025be207' 'fef6fadd0739ae03ff71ba61025be207'
'afb84ad0316af0aca421b36eaa2bbd90' 'afb84ad0316af0aca421b36eaa2bbd90'
'00045683c06924d765ac14887218ffcc' '00045683c06924d765ac14887218ffcc'
'1f31f0e0ee859ed43b512121b61edc69') 'ae1a827fe7fa5ff62b1b5627d6850c82')
_game="minecraft" _game="minecraft"
_server_root="/srv/minecraft" _server_root="/srv/minecraft"

View File

@ -89,7 +89,7 @@ idle_server_daemon() {
# and since playernames may not contain this string the clean player-list can be easily retrieved. # 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 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 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} # Stop the game server if no player was active for at least ${IDLE_IF_TIME}
if [[ "${no_player}" -ge "${IDLE_IF_TIME}" ]]; then if [[ "${no_player}" -ge "${IDLE_IF_TIME}" ]]; then
IDLE_SERVER="false" ${myname} stop 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!" [[ $i -eq 100 ]] && echo -e "An \e[39;1merror\e[0m occurred while trying to reset the idle_server!"
sleep 0.1 sleep 0.1
done done
# Reset timer # Reset timer and give the player 300 seconds to connect after pinging
no_player=0 no_player=$(( IDLE_IF_TIME - 300 ))
# Game server is down, listen on port ${GAME_PORT} for incoming connections # Game server is down, listen on port ${GAME_PORT} for incoming connections
echo "Netcat is listening 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} ${NETCAT_CMD} -v -l -p ${GAME_PORT}
@ -109,11 +109,12 @@ idle_server_daemon() {
IDLE_SERVER="false" ${myname} start IDLE_SERVER="false" ${myname} start
fi fi
elif [[ $? -eq 0 ]]; then elif [[ $? -eq 0 ]]; then
# Reset timer since there is an active player on the server
no_player=0 no_player=0
fi fi
else else
# Reset timer # Reset timer and give the player 300 seconds to connect after pinging
no_player=0 no_player=$(( IDLE_IF_TIME - 300 ))
# Game server is down, listen on port ${GAME_PORT} for incoming connections # Game server is down, listen on port ${GAME_PORT} for incoming connections
echo "Netcat is listening 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} ${NETCAT_CMD} -v -l -p ${GAME_PORT}
@ -317,7 +318,7 @@ backup_restore() {
i=1 i=1
for f in "${BACKUP_DEST}"/[0-9_.]*; do for f in "${BACKUP_DEST}"/[0-9_.]*; do
echo -e " \e[39;1m$i)\e[0m\t$f" echo -e " \e[39;1m$i)\e[0m\t$f"
i=$((i+1)) i=$(( i + 1 ))
done done
echo -en "Restore backup number: " echo -en "Restore backup number: "
@ -329,7 +330,7 @@ backup_restore() {
n=1 n=1
for f in "${BACKUP_DEST}"/[0-9_.]*; do for f in "${BACKUP_DEST}"/[0-9_.]*; do
[[ ${n} -eq $user_choice ]] && FILE="$f" [[ ${n} -eq $user_choice ]] && FILE="$f"
n=$((n+1)) n=$(( n + 1 ))
done done
if [[ -z $FILE ]]; then if [[ -z $FILE ]]; then
>&2 echo -e "\e[39;1mFailed\e[0m to interpret your input. Please enter the digit of the presented options." >&2 echo -e "\e[39;1mFailed\e[0m to interpret your input. Please enter the digit of the presented options."