Stop warning if server is offline

This commit is contained in:
Ben Peddell 2016-07-16 13:21:25 +10:00
parent ca9ea08ebe
commit 94f3e9566d

View File

@ -1174,7 +1174,10 @@ doWarn(){
for (( min = warnminutes; min >= warninterval; min-- )); do
numplayers=$(numPlayersConnected)
echo "There are ${numplayers} players connected"
if (( (numplayers + 0) == 0 )); then
if [[ "numplayers" == "-1" ]]; then
echo "Server is not running. Shutting down immediately"
return 0
elif (( (numplayers + 0) == 0 )); then
doBroadcastWithEcho "Nobody is connected. Shutting down immediately"
rm -f "${arkserverroot}/.ark-warn.lock"
return 0
@ -1207,7 +1210,10 @@ doWarn(){
if (( warnseconds >= 20 )); then
numplayers=$(numPlayersConnected)
echo "There are ${numplayers} players connected"
if (( (numplayers + 0) == 0 )); then
if [[ "numplayers" == "-1" ]]; then
echo "Server is not running. Shutting down immediately"
return 0
elif (( (numplayers + 0) == 0 )); then
doBroadcastWithEcho "Nobody is connected. Shutting down immediately"
rm -f "${arkserverroot}/.ark-warn.lock"
return 0