mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-21 22:38:26 +00:00
Merge pull request #161 from klightspeed/1.3#warn
Add option to warn players before update
This commit is contained in:
commit
c45d74a2ff
@ -162,6 +162,14 @@ doBroadcast(){
|
|||||||
rconcmd "broadcast $1" >/dev/null
|
rconcmd "broadcast $1" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Broadcast message with echo
|
||||||
|
#
|
||||||
|
doBroadcastWithEcho(){
|
||||||
|
echo "$1"
|
||||||
|
doBroadcast "$1"
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check if a new version is available but not apply it
|
# Check if a new version is available but not apply it
|
||||||
#
|
#
|
||||||
@ -442,6 +450,51 @@ doSafeUpdate(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Waits for a configurable number of minutes before updating the server
|
||||||
|
#
|
||||||
|
doWarnUpdate(){
|
||||||
|
cd "$arkserverroot"
|
||||||
|
|
||||||
|
if isUpdateNeeded; then
|
||||||
|
local pid=`getServerPID`
|
||||||
|
if [ -n "$pid" ]; then
|
||||||
|
local warnminutes=$(( arkwarnminutes ))
|
||||||
|
if (( warnminutes == 0 )); then
|
||||||
|
warnminutes=60
|
||||||
|
fi
|
||||||
|
|
||||||
|
local warnintervals=( 90 60 45 30 20 15 10 5 4 3 2 1 )
|
||||||
|
|
||||||
|
for warninterval in "${warnintervals[@]}"; do
|
||||||
|
if [ "`getServerPID`" != "$pid" ]; then
|
||||||
|
echo "Server has stopped. Aborting update"
|
||||||
|
fi
|
||||||
|
if (( arkwarnminutes > warninterval )); then
|
||||||
|
doBroadcastWithEcho "This ARK server will shutdown for an update in $warnminutes minutes"
|
||||||
|
sleep $(( warnminutes - warninterval ))m
|
||||||
|
warnminutes=$warninterval
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local warnseconds=90
|
||||||
|
warnintervals=( 60 45 30 20 15 10 5 0 )
|
||||||
|
for warninterval in "${warnintervals[@]}"; do
|
||||||
|
if [ "`getServerPID`" != "$pid" ]; then
|
||||||
|
echo "Server has stopped. Aborting update"
|
||||||
|
fi
|
||||||
|
doBroadcastWithEcho "This ARK server will shutdown for an update in $warnseconds seconds"
|
||||||
|
sleep $(( warnseconds - warninterval ))s
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "`getServerPID`" != "$pid" ]; then
|
||||||
|
echo "Server has stopped. Aborting update"
|
||||||
|
fi
|
||||||
|
doUpdate
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copies server state to a backup directory
|
# Copies server state to a backup directory
|
||||||
#
|
#
|
||||||
@ -646,6 +699,9 @@ while true; do
|
|||||||
elif [ "$2" == "--safe" ]; then
|
elif [ "$2" == "--safe" ]; then
|
||||||
doSafeUpdate
|
doSafeUpdate
|
||||||
shift
|
shift
|
||||||
|
elif [ "$2" == "--warn" ]; then
|
||||||
|
doWarnUpdate
|
||||||
|
shift
|
||||||
else
|
else
|
||||||
doUpdate
|
doUpdate
|
||||||
fi
|
fi
|
||||||
@ -693,6 +749,7 @@ while true; do
|
|||||||
echo "update Check for a new ARK server version, if needed, stops the server, updates it, and starts it again"
|
echo "update Check for a new ARK server version, if needed, stops the server, updates it, and starts it again"
|
||||||
echo "update --force Apply update without check the current version"
|
echo "update --force Apply update without check the current version"
|
||||||
echo "update --safe Wait for server to perform world save and update."
|
echo "update --safe Wait for server to perform world save and update."
|
||||||
|
echo "update --warn Warn players before updating server"
|
||||||
echo "upgrade Check for a new ARK Server Tools version and upgrades it if needed"
|
echo "upgrade Check for a new ARK Server Tools version and upgrades it if needed"
|
||||||
echo "useconfig <name> Use the configuration overrides in the specified config name or file"
|
echo "useconfig <name> Use the configuration overrides in the specified config name or file"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -10,6 +10,7 @@ steamcmd_appinfocache="/home/steam/Steam/appcache/appinfo.vdf" # cache of t
|
|||||||
arkserverroot="/home/steam/ARK" # path of your ARK server files (default ~/ARK)
|
arkserverroot="/home/steam/ARK" # path of your ARK server files (default ~/ARK)
|
||||||
arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer" # name of ARK server executable
|
arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer" # name of ARK server executable
|
||||||
arkbackupdir="/home/steam/ARK-Backups" # path to backup directory
|
arkbackupdir="/home/steam/ARK-Backups" # path to backup directory
|
||||||
|
arkwarnminutes="60" # number of minutes to warn players when using update --warn
|
||||||
|
|
||||||
# ARK server options - use ark_<optionname>=<value>
|
# ARK server options - use ark_<optionname>=<value>
|
||||||
# comment out these values if you want to define them
|
# comment out these values if you want to define them
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user