summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordian Edenhofer2016-04-03 16:33:16 +0200
committerGordian Edenhofer2016-04-03 16:33:16 +0200
commit0a4c078d7548b022203bbd9d3f24c8f1f05e0387 (patch)
tree7ccd2d9b26bcdf803068a4871360a1104fbc4688
parent87f0b53c40ffe6968121cb5e6789b397a3e406fb (diff)
downloadaur-0a4c078d7548b022203bbd9d3f24c8f1f05e0387.tar.gz
Upgpkg: 1.9.2-3
Escape colored game-command output when evaluating the logs. Though this is not the default for the stock server, some plugins add color to e.g. list. Set tail -f refresh interval to 0.1s (default 1s) to speedily escape.
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rwxr-xr-xminecraftd.sh8
3 files changed, 8 insertions, 8 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 8c4d0280b83..6cc09eb2306 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 = 2
+ pkgrel = 3
url = http://minecraft.net/
install = minecraft-server.install
arch = any
@@ -28,6 +28,6 @@ pkgbase = minecraft-server
md5sums = fef6fadd0739ae03ff71ba61025be207
md5sums = afb84ad0316af0aca421b36eaa2bbd90
md5sums = 00045683c06924d765ac14887218ffcc
- md5sums = bdd49792d54f147cd2f6048f1559d676
+ md5sums = 07fc6725f5354e4eca5a56c039577764
pkgname = minecraft-server
diff --git a/PKGBUILD b/PKGBUILD
index 5d5821d1b78..b1a7117f228 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
pkgname=minecraft-server
pkgver=1.9.2
-pkgrel=2
+pkgrel=3
pkgdesc="Minecraft server unit files, script, and jar"
arch=('any')
url="http://minecraft.net/"
@@ -28,7 +28,7 @@ md5sums=('560d467028f17a70997151ed0053deb6'
'fef6fadd0739ae03ff71ba61025be207'
'afb84ad0316af0aca421b36eaa2bbd90'
'00045683c06924d765ac14887218ffcc'
- 'bdd49792d54f147cd2f6048f1559d676')
+ '07fc6725f5354e4eca5a56c039577764')
_game="minecraft"
_server_root="/srv/minecraft"
diff --git a/minecraftd.sh b/minecraftd.sh
index 4ef6997592b..a53bcdea572 100755
--- a/minecraftd.sh
+++ b/minecraftd.sh
@@ -87,7 +87,7 @@ idle_server_daemon() {
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 '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=$((no_player + CHECK_PLAYER_TIME))
# Stop the game server if no player was active for at least ${IDLE_IF_TIME}
@@ -184,7 +184,7 @@ server_stop() {
${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 '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
echo -en "Server is going down..."
game_command stop
@@ -239,7 +239,7 @@ server_status() {
# Calculating memory usage
for p in $(${SUDO_CMD} pgrep -f "${MAIN_EXECUTABLE}"); do
- ps -p${p} -O rss | tail -n1;
+ ps -p${p} -O rss | tail -n 1;
done | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =", count, "(screen, bash,", count-2, "x java)"; print "Total memory usage =", sum/1024, "MB" ;};'
else
echo -e "Status:\e[39;1m stopped\e[0m"
@@ -371,7 +371,7 @@ server_command() {
${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
if [[ $? -eq 0 ]]; then
- ${SUDO_CMD} sleep 0.3 & tail -f --pid=$! -n 0 "${LOGPATH}/latest.log" &
+ ${SUDO_CMD} sleep 0.3 & tail -f --pid=$! -s 0.1 -n 0 "${LOGPATH}/latest.log" &
game_command "$@"
wait
else