aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordian Edenhofer2016-05-20 11:53:30 +0200
committerGordian Edenhofer2016-05-20 11:53:30 +0200
commit9fafea9acfad5efe2525d3a1171ae0f7d38c0141 (patch)
treeb2b31673c1f0af447ab48cb6cf6430540ad6aaae
parent53bb3e07646e83182bac85584c0ea9a335139e32 (diff)
downloadaur-9fafea9acfad5efe2525d3a1171ae0f7d38c0141.tar.gz
upgpkg: (minecraft-server|spigot) 1.9.4-2
Pause player checking when in idle_server mode as long as someone is connected to the server console. Not only does it make sense for any admin which wants to monitor the console, it also removes annoying list invocations from the console while e.g. typing in it. upgpkg: minecraft-server 1.9.4-2 upgpkg: spigot 1.9.4-2
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rwxr-xr-xminecraftd.sh15
3 files changed, 13 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 38ae18534bc6..eb419de6539d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = minecraft-server
pkgdesc = Minecraft server unit files, script, and jar
pkgver = 1.9.4
- pkgrel = 1
+ pkgrel = 2
url = http://minecraft.net/
install = minecraft-server.install
arch = any
@@ -27,6 +27,6 @@ pkgbase = minecraft-server
md5sums = fef6fadd0739ae03ff71ba61025be207
md5sums = afb84ad0316af0aca421b36eaa2bbd90
md5sums = 00045683c06924d765ac14887218ffcc
- md5sums = ae1a827fe7fa5ff62b1b5627d6850c82
+ md5sums = 0d0a8999614edeb1614f425b48d0878c
pkgname = minecraft-server
diff --git a/PKGBUILD b/PKGBUILD
index 0d4f191f41ec..8604049a00ad 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
pkgname=minecraft-server
pkgver=1.9.4
-pkgrel=1
+pkgrel=2
pkgdesc="Minecraft server unit files, script, and jar"
arch=('any')
url="http://minecraft.net/"
@@ -27,7 +27,7 @@ md5sums=('292feb3085809e714da2ca75514b9d5b'
'fef6fadd0739ae03ff71ba61025be207'
'afb84ad0316af0aca421b36eaa2bbd90'
'00045683c06924d765ac14887218ffcc'
- 'ae1a827fe7fa5ff62b1b5627d6850c82')
+ '0d0a8999614edeb1614f425b48d0878c')
_game="minecraft"
_server_root="/srv/minecraft"
diff --git a/minecraftd.sh b/minecraftd.sh
index e0a07aac4d43..3013eed6522c 100755
--- a/minecraftd.sh
+++ b/minecraftd.sh
@@ -78,16 +78,19 @@ idle_server_daemon() {
no_player=0
while true; do
+ echo -e "no_players: ${no_player}s\tcheck_player_time: ${CHECK_PLAYER_TIME}s\tidle_if_time: ${IDLE_IF_TIME}s"
# Retry in ${CHECK_PLAYER_TIME} seconds
sleep ${CHECK_PLAYER_TIME}
screen -S "${SESSION_NAME}" -Q select . > /dev/null
if [[ $? -eq 0 ]]; then
# Game server is up and running
- screen -S "${SESSION_NAME}" -X stuff "`printf \"list\r\"`"
+ if [[ "$(screen -S "${SESSION_NAME}" -ls | sed -n 2p | awk '{ print $2 }')" == "(Attached)" ]]; then
+ # An administrator is connected to the console, pause player checking
+ echo "An admin is connected to the console. Pause player checking."
# The list command prints a line containing the usernames after the last occurrence of ": "
# 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
+ elif [[ -z $(SUDO_CMD="" game_command list; 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 ))
# Stop the game server if no player was active for at least ${IDLE_IF_TIME}
@@ -103,7 +106,7 @@ idle_server_daemon() {
# 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..."
+ echo -n "Netcat: "
${NETCAT_CMD} -v -l -p ${GAME_PORT}
[[ $? -eq 0 ]] && echo "Netcat caught an connection. The server is coming up again..."
IDLE_SERVER="false" ${myname} start
@@ -116,7 +119,7 @@ idle_server_daemon() {
# 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..."
+ echo -n "Netcat: "
${NETCAT_CMD} -v -l -p ${GAME_PORT}
[[ $? -eq 0 ]] && echo "Netcat caught an connection. The server is coming up again..."
IDLE_SERVER="false" ${myname} start
@@ -186,10 +189,10 @@ server_stop() {
${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
if [[ $? -eq 0 ]]; then
# Game server is up and running, gracefully stop the server when there are still active players
- ${SUDO_CMD} screen -S "${SESSION_NAME}" -X stuff "`printf \"list\r\"`"
+
# The list command prints a line containing the usernames after the last occurrence of ": "
# 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 [[ -z $(game_command list; 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
echo -en "Server is going down..."
game_command stop