From 57c082bbbd2ef83dd032816606508e8e7a2c5504 Mon Sep 17 00:00:00 2001 From: Gordian Edenhofer Date: Sun, 13 Mar 2016 22:07:58 +0100 Subject: [PATCH] Upgpkg: 1.9-6 Renaming variables in the configuration file. Increase time-out time to 10 seconds when shutting down the idle_server. Minor redesign when passing commands to the minecraft server console. --- .SRCINFO | 4 ++-- PKGBUILD | 4 ++-- minecraftd.conf | 8 ++++---- minecraftd.sh | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 5b54801..7d8de8f 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -27,7 +27,7 @@ pkgbase = minecraft-server md5sums = b786935d6517d46fe0944377daba32b8 md5sums = fef6fadd0739ae03ff71ba61025be207 md5sums = afb84ad0316af0aca421b36eaa2bbd90 - md5sums = 54438e0c47cc5083e0a4376688b46092 - md5sums = 98fe0fdfe4021a522739e3e14601ad9f + md5sums = 00045683c06924d765ac14887218ffcc + md5sums = 18f23e5ad6547e6110a407808de40332 pkgname = minecraft-server diff --git a/PKGBUILD b/PKGBUILD index b5b55bf..96dae56 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -27,8 +27,8 @@ md5sums=('ff68834eee875bcf367422c67673207c' 'b786935d6517d46fe0944377daba32b8' 'fef6fadd0739ae03ff71ba61025be207' 'afb84ad0316af0aca421b36eaa2bbd90' - '54438e0c47cc5083e0a4376688b46092' - '98fe0fdfe4021a522739e3e14601ad9f') + '00045683c06924d765ac14887218ffcc' + '18f23e5ad6547e6110a407808de40332') _game="minecraft" _server_root="/srv/minecraft" diff --git a/minecraftd.conf b/minecraftd.conf index 40f1aec..1c59ab4 100644 --- a/minecraftd.conf +++ b/minecraftd.conf @@ -3,12 +3,12 @@ # General parameters SERVER_ROOT="/srv/minecraft" -BACKUPPATH="/srv/minecraft/backup" +BACKUP_DEST="/srv/minecraft/backup" LOGPATH="/srv/minecraft/logs" -WORLDPATHS="world" # World paths separated by spaces relative to SERVER_ROOT +BACKUP_PATHS="world" # World paths separated by spaces relative to SERVER_ROOT KEEP_BACKUPS="10" -MC_USER="minecraft" -MAIN_JAR="minecraft_server.jar" +GAME_USER="minecraft" +MAIN_EXECUTABLE="minecraft_server.jar" SESSION_NAME="minecraft" # System parameters for java diff --git a/minecraftd.sh b/minecraftd.sh index 43e5d40..56ef155 100755 --- a/minecraftd.sh +++ b/minecraftd.sh @@ -93,10 +93,10 @@ idle_server_daemon() { if [[ "${no_player}" -ge "${IDLE_IF_TIME}" ]]; then IDLE_SERVER="false" ${myname} stop # Wait for game server to go down - for i in {1..90}; do + for i in {1..100}; do screen -S "${SESSION_NAME}" -Q select . > /dev/null [[ $? -eq 1 ]] && break - [[ $i -eq 90 ]] && echo -e "\e[39;1m An error occured while trying to reset the idle_server! \e[0m" + [[ $i -eq 100 ]] && echo -e "An \e[39;1merror\e[0m occured while trying to reset the idle_server!" sleep 0.1 done # Listen on port ${GAME_PORT} for incoming connections @@ -142,10 +142,10 @@ server_start() { if [[ $? -eq 0 ]]; then ${SUDO_CMD} screen -S "${IDLE_SESSION_NAME}" -X quit # Restart as soon as the idle_server_daemon has shut down completely - for i in {1..30}; do + for i in {1..100}; do ${SUDO_CMD} screen -S "${IDLE_SESSION_NAME}" -Q select . > /dev/null [[ $? -eq 1 ]] && ${SUDO_CMD} screen -dmS "${IDLE_SESSION_NAME}" /bin/bash -c "${myname} idle_server_daemon" && break - [[ $i -eq 30 ]] && echo -e "\e[39;1m An error occured while trying to reset the idle_server! \e[0m" + [[ $i -eq 100 ]] && echo -e "An \e[39;1merror\e[0m occured while trying to reset the idle_server!" sleep 0.1 done else @@ -182,7 +182,7 @@ server_stop() { game_command save-all game_command say "Server is going down in 10 seconds! HURRY UP WITH WHATEVER YOU ARE DOING!" # Warning the users echo -en "Server is going down in... " - for i in $(seq 1 10); do + for i in {1..10}; do game_command say "down in... $(expr 10 - $i)" echo -n " $(expr 10 - $i)" sleep 1 @@ -190,10 +190,10 @@ server_stop() { game_command stop # Finish as soon as the server has shut down completely - for i in {1..30}; do + for i in {1..100}; do ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null [[ $? -eq 1 ]] && echo -e "\e[39;1m done\e[0m" && break - [[ $i -eq 30 ]] && echo -e "\e[39;1m ERROR\e[0m" + [[ $i -eq 100 ]] && echo -e "\e[39;1m timed out\e[0m" sleep 0.1 done else @@ -358,10 +358,10 @@ server_command() { ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null if [[ $? -eq 0 ]]; then - sleep 0.2s & + sleep 0.2 & sleep_pid=$! - game_command "$@" & - tail -f --pid=${sleep_pid} -n 0 "${LOGPATH}/latest.log" + game_command "$@" + ${SUDO_CMD} tail -f --pid=${sleep_pid} -n 0 "${LOGPATH}/latest.log" else echo "There is no ${SESSION_NAME} session to connect to." fi