Merge pull request #1074 from MrSlimbrowser/preciseWarn

obey warn time even if no players are connected
This commit is contained in:
Ben Peddell 2020-03-09 21:42:07 +10:00 committed by GitHub
commit 9ee4e70e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 22 deletions

View File

@ -1776,17 +1776,19 @@ doWarn(){
printWarnMessage "$1" "$2" "minutes" "$warnminutes" "$usenotify"
usenotify=
for (( min = warnminutes - 1; min >= warninterval; min-- )); do
numplayers=$(numPlayersConnected)
echo "There are ${numplayers} players connected"
if [[ "numplayers" == "-1" ]]; then
echo "Server is not running. Shutting down immediately"
notify "${notifyMsgServerNotRunning:-Server is not running. Shutting down immediately}"
return 0
elif (( (numplayers + 0) == 0 )); then
doBroadcastWithEcho "Nobody is connected. Shutting down immediately"
notify "${notifyMsgNobodyConnected:-Nobody is connected. Shutting down immediately}"
rm -f "${arkserverroot}/${arkwarnlockfile}"
return 0
if [ "$arkprecisewarn" != "true" ]; then
numplayers=$(numPlayersConnected)
echo "There are ${numplayers} players connected"
if [[ "numplayers" == "-1" ]]; then
echo "Server is not running. Shutting down immediately"
notify "${notifyMsgServerNotRunning:-Server is not running. Shutting down immediately}"
return 0
elif (( (numplayers + 0) == 0 )); then
doBroadcastWithEcho "Nobody is connected. Shutting down immediately"
notify "${notifyMsgNobodyConnected:-Nobody is connected. Shutting down immediately}"
rm -f "${arkserverroot}/${arkwarnlockfile}"
return 0
fi
fi
if isUpdateCancelRequested; then
doBroadcastWithEcho "Restart cancelled by player request"
@ -1821,17 +1823,19 @@ doWarn(){
printWarnMessage "$1" "$2" "seconds" "$warnseconds" "$usenotify"
usenotify=
if (( warnseconds >= 20 )); then
numplayers=$(numPlayersConnected)
echo "There are ${numplayers} players connected"
if [[ "numplayers" == "-1" ]]; then
echo "Server is not running. Shutting down immediately"
notify "${notifyMsgServerNotRunning:-Server is not running. Shutting down immediately}"
return 0
elif (( (numplayers + 0) == 0 )); then
doBroadcastWithEcho "Nobody is connected. Shutting down immediately"
notify "${notifyMsgNobodyConnected:-Nobody is connected. Shutting down immediately}"
rm -f "${arkserverroot}/${arkwarnlockfile}"
return 0
if [ "$arkprecisewarn" != "true" ]; then
numplayers=$(numPlayersConnected)
echo "There are ${numplayers} players connected"
if [[ "numplayers" == "-1" ]]; then
echo "Server is not running. Shutting down immediately"
notify "${notifyMsgServerNotRunning:-Server is not running. Shutting down immediately}"
return 0
elif (( (numplayers + 0) == 0 )); then
doBroadcastWithEcho "Nobody is connected. Shutting down immediately"
notify "${notifyMsgNobodyConnected:-Nobody is connected. Shutting down immediately}"
rm -f "${arkserverroot}/${arkwarnlockfile}"
return 0
fi
fi
if isUpdateCancelRequested; then
doBroadcastWithEcho "Restart cancelled by player request"

View File

@ -16,6 +16,7 @@ steamcmd_workshoplog="/home/steam/Steam/logs/workshop_log.txt" # Steam work
arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer" # name of ARK server executable
arkbackupdir="/home/steam/ARK-Backups" # path to backup directory
arkwarnminutes="60" # number of minutes to warn players when using update --warn
arkprecisewarn="false" # set this to true to obey warnminutes even if no players are connected (recommended for clusters)
arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file
arkAutoUpdateOnStart="false" # set this to true if you want to always update before startup
arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating