mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-14 19:48:27 +00:00
Merge pull request #567 from klightspeed/prevent-start-during-update
Prevent server start during update
This commit is contained in:
commit
97875f88aa
@ -591,6 +591,14 @@ function numPlayersConnected(){
|
||||
doRun() {
|
||||
cd "$arkserverroot"
|
||||
|
||||
if [ -f "${arkserverroot}/.ark-update.lock" ]; then
|
||||
local updatepid="$(<"${arkserverroot}/.ark-update.lock")"
|
||||
if kill -0 "$updatepid" >/dev/null 2>&1; then
|
||||
echo "An update is currently in progress. Start aborted"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
arkserveropts="$serverMap"
|
||||
|
||||
if [ -n "$serverMapModId" ]; then
|
||||
@ -728,6 +736,15 @@ doRun() {
|
||||
# start function
|
||||
#
|
||||
doStart() {
|
||||
if [ -f "${arkserverroot}/.ark-update.lock" ]; then
|
||||
local updatepid="$(<"${arkserverroot}/.ark-update.lock")"
|
||||
if kill -0 "$updatepid" >/dev/null 2>&1; then
|
||||
touch "${arkserverroot}/.startAfterUpdate"
|
||||
echo "An update is currently in progress. Start aborted"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if isTheServerRunning; then
|
||||
echo "The server is already running"
|
||||
else
|
||||
@ -766,6 +783,8 @@ doStartAll(){
|
||||
# stop the ARK server
|
||||
#
|
||||
doStop() {
|
||||
rm -f "${arkserverroot}/.startAfterUpdate"
|
||||
|
||||
if isTheServerRunning; then
|
||||
if [[ " $* " =~ " --warn " ]]; then
|
||||
doWarn "$1"
|
||||
@ -1151,7 +1170,9 @@ doUpdate() {
|
||||
fi
|
||||
|
||||
# we restart the server only if it was started before the update
|
||||
if [ $serverWasAlive -eq 1 ]; then
|
||||
if [ $serverWasAlive -eq 1 ] || [ -f "${arkserverroot}/.startAfterUpdate" ]; then
|
||||
rm -f "${arkserverroot}/.startAfterUpdate"
|
||||
rm -f "${arkserverroot}/.ark-update.lock"
|
||||
doStart --noautoupdate
|
||||
fi
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user