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.
This commit is contained in:
Gordian Edenhofer 2016-03-13 22:07:58 +01:00
parent 8cba936144
commit 57c082bbbd
4 changed files with 18 additions and 18 deletions

View File

@ -27,7 +27,7 @@ pkgbase = minecraft-server
md5sums = b786935d6517d46fe0944377daba32b8 md5sums = b786935d6517d46fe0944377daba32b8
md5sums = fef6fadd0739ae03ff71ba61025be207 md5sums = fef6fadd0739ae03ff71ba61025be207
md5sums = afb84ad0316af0aca421b36eaa2bbd90 md5sums = afb84ad0316af0aca421b36eaa2bbd90
md5sums = 54438e0c47cc5083e0a4376688b46092 md5sums = 00045683c06924d765ac14887218ffcc
md5sums = 98fe0fdfe4021a522739e3e14601ad9f md5sums = 18f23e5ad6547e6110a407808de40332
pkgname = minecraft-server pkgname = minecraft-server

View File

@ -27,8 +27,8 @@ md5sums=('ff68834eee875bcf367422c67673207c'
'b786935d6517d46fe0944377daba32b8' 'b786935d6517d46fe0944377daba32b8'
'fef6fadd0739ae03ff71ba61025be207' 'fef6fadd0739ae03ff71ba61025be207'
'afb84ad0316af0aca421b36eaa2bbd90' 'afb84ad0316af0aca421b36eaa2bbd90'
'54438e0c47cc5083e0a4376688b46092' '00045683c06924d765ac14887218ffcc'
'98fe0fdfe4021a522739e3e14601ad9f') '18f23e5ad6547e6110a407808de40332')
_game="minecraft" _game="minecraft"
_server_root="/srv/minecraft" _server_root="/srv/minecraft"

View File

@ -3,12 +3,12 @@
# General parameters # General parameters
SERVER_ROOT="/srv/minecraft" SERVER_ROOT="/srv/minecraft"
BACKUPPATH="/srv/minecraft/backup" BACKUP_DEST="/srv/minecraft/backup"
LOGPATH="/srv/minecraft/logs" 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" KEEP_BACKUPS="10"
MC_USER="minecraft" GAME_USER="minecraft"
MAIN_JAR="minecraft_server.jar" MAIN_EXECUTABLE="minecraft_server.jar"
SESSION_NAME="minecraft" SESSION_NAME="minecraft"
# System parameters for java # System parameters for java

View File

@ -93,10 +93,10 @@ idle_server_daemon() {
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
# Wait for game server to go down # 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 screen -S "${SESSION_NAME}" -Q select . > /dev/null
[[ $? -eq 1 ]] && break [[ $? -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 sleep 0.1
done done
# Listen on port ${GAME_PORT} for incoming connections # Listen on port ${GAME_PORT} for incoming connections
@ -142,10 +142,10 @@ server_start() {
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
${SUDO_CMD} screen -S "${IDLE_SESSION_NAME}" -X quit ${SUDO_CMD} screen -S "${IDLE_SESSION_NAME}" -X quit
# Restart as soon as the idle_server_daemon has shut down completely # 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 ${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 [[ $? -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 sleep 0.1
done done
else else
@ -182,7 +182,7 @@ server_stop() {
game_command save-all game_command save-all
game_command say "Server is going down in 10 seconds! HURRY UP WITH WHATEVER YOU ARE DOING!" # Warning the users 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... " 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)" game_command say "down in... $(expr 10 - $i)"
echo -n " $(expr 10 - $i)" echo -n " $(expr 10 - $i)"
sleep 1 sleep 1
@ -190,10 +190,10 @@ server_stop() {
game_command stop game_command stop
# Finish as soon as the server has shut down completely # 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 ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
[[ $? -eq 1 ]] && echo -e "\e[39;1m done\e[0m" && break [[ $? -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 sleep 0.1
done done
else else
@ -358,10 +358,10 @@ server_command() {
${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
sleep 0.2s & sleep 0.2 &
sleep_pid=$! sleep_pid=$!
game_command "$@" & game_command "$@"
tail -f --pid=${sleep_pid} -n 0 "${LOGPATH}/latest.log" ${SUDO_CMD} tail -f --pid=${sleep_pid} -n 0 "${LOGPATH}/latest.log"
else else
echo "There is no ${SESSION_NAME} session to connect to." echo "There is no ${SESSION_NAME} session to connect to."
fi fi