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.
This commit is contained in:
Gordian Edenhofer 2016-04-03 16:33:16 +02:00
parent 87f0b53c40
commit 0a4c078d75
3 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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"

View File

@ -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