Upgpkg: 1.9-6
On server stop, return to the prompt as soon as the server has completely shut down, not as soon as the shutdown command has been sent. Thereby fixing the restart capability. Introduce sanity check whether the servers is really down in idle_daemon and server_start as well. Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
This commit is contained in:
parent
904e9c8273
commit
8cba936144
4
.SRCINFO
4
.SRCINFO
|
@ -1,7 +1,7 @@
|
|||
pkgbase = minecraft-server
|
||||
pkgdesc = Minecraft server unit files, script, and jar
|
||||
pkgver = 1.9
|
||||
pkgrel = 5
|
||||
pkgrel = 6
|
||||
url = http://minecraft.net/
|
||||
install = minecraft-server.install
|
||||
arch = any
|
||||
|
@ -28,6 +28,6 @@ pkgbase = minecraft-server
|
|||
md5sums = fef6fadd0739ae03ff71ba61025be207
|
||||
md5sums = afb84ad0316af0aca421b36eaa2bbd90
|
||||
md5sums = 54438e0c47cc5083e0a4376688b46092
|
||||
md5sums = e2fae644262285b633db924b0a384613
|
||||
md5sums = 98fe0fdfe4021a522739e3e14601ad9f
|
||||
|
||||
pkgname = minecraft-server
|
||||
|
|
4
PKGBUILD
4
PKGBUILD
|
@ -4,7 +4,7 @@
|
|||
|
||||
pkgname=minecraft-server
|
||||
pkgver=1.9
|
||||
pkgrel=5
|
||||
pkgrel=6
|
||||
pkgdesc="Minecraft server unit files, script, and jar"
|
||||
arch=('any')
|
||||
url="http://minecraft.net/"
|
||||
|
@ -28,7 +28,7 @@ md5sums=('ff68834eee875bcf367422c67673207c'
|
|||
'fef6fadd0739ae03ff71ba61025be207'
|
||||
'afb84ad0316af0aca421b36eaa2bbd90'
|
||||
'54438e0c47cc5083e0a4376688b46092'
|
||||
'e2fae644262285b633db924b0a384613')
|
||||
'98fe0fdfe4021a522739e3e14601ad9f')
|
||||
|
||||
_game="minecraft"
|
||||
_server_root="/srv/minecraft"
|
||||
|
|
|
@ -92,15 +92,20 @@ idle_server_daemon() {
|
|||
# Stop the game server if no player was active for at least ${IDLE_IF_TIME}
|
||||
if [[ "${no_player}" -ge "${IDLE_IF_TIME}" ]]; then
|
||||
IDLE_SERVER="false" ${myname} stop
|
||||
|
||||
# Game server is down, listen on port ${GAME_PORT} for incoming connections
|
||||
sleep 1
|
||||
# Wait for game server to go down
|
||||
for i in {1..90}; 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"
|
||||
sleep 0.1
|
||||
done
|
||||
# Listen on port ${GAME_PORT} for incoming connections
|
||||
echo "Netcat is listening on port ${GAME_PORT} for incoming connections..."
|
||||
${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
|
||||
fi
|
||||
else
|
||||
elif [[ $? -eq 0 ]]; then
|
||||
no_player=0
|
||||
fi
|
||||
else
|
||||
|
@ -136,8 +141,13 @@ server_start() {
|
|||
${SUDO_CMD} screen -S "${IDLE_SESSION_NAME}" -Q select . > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
${SUDO_CMD} screen -S "${IDLE_SESSION_NAME}" -X quit
|
||||
sleep 0.5
|
||||
${SUDO_CMD} screen -dmS "${IDLE_SESSION_NAME}" /bin/bash -c "${myname} idle_server_daemon"
|
||||
# Restart as soon as the idle_server_daemon has shut down completely
|
||||
for i in {1..30}; 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"
|
||||
sleep 0.1
|
||||
done
|
||||
else
|
||||
echo -en "Starting idle server daeomon... "
|
||||
${SUDO_CMD} screen -dmS "${IDLE_SESSION_NAME}" /bin/bash -c "${myname} idle_server_daemon"
|
||||
|
@ -178,7 +188,14 @@ server_stop() {
|
|||
sleep 1
|
||||
done
|
||||
game_command stop
|
||||
echo -e "\e[39;1m done\e[0m"
|
||||
|
||||
# Finish as soon as the server has shut down completely
|
||||
for i in {1..30}; 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"
|
||||
sleep 0.1
|
||||
done
|
||||
else
|
||||
echo "The corresponding screen session for ${SESSION_NAME} was already dead."
|
||||
fi
|
||||
|
@ -221,7 +238,6 @@ server_restart() {
|
|||
${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
server_stop
|
||||
sleep 0.5
|
||||
server_start
|
||||
else
|
||||
server_start
|
||||
|
|
Loading…
Reference in New Issue
Block a user