diff --git a/lgsm/modules/check_players_online.sh b/lgsm/modules/check_players_online.sh index a3dd18680..b38de1f70 100755 --- a/lgsm/modules/check_players_online.sh +++ b/lgsm/modules/check_players_online.sh @@ -12,14 +12,23 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" playersonline="" if [ "${stoponlyifnoplayers}" == "on" ]; then if [ "${querymode}" == "2" ] || [ "${querymode}" == "3" ]; then + querysucceeded="0" for queryip in "${queryips[@]}"; do query_gamedig.sh if [ "${querystatus}" == "0" ]; then + querysucceeded="1" if [ -n "${gdplayers}" ] && [ "${gdplayers}" -ne 0 ]; then playersonline="${gdplayers}" break fi fi done + # The query failed for every configured IP, so the player count could not be + # determined. Fail open (proceed as if empty) rather than block the server + # indefinitely, but warn clearly since the safety check did not actually run. + if [ "${querysucceeded}" == "0" ]; then + fn_print_warn_nl "Unable to determine player count: stoponlyifnoplayers check skipped" + fn_script_log_warn "Unable to determine player count via gamedig: stoponlyifnoplayers check skipped" + fi fi fi diff --git a/lgsm/modules/command_restart.sh b/lgsm/modules/command_restart.sh index 209064310..245c0d52d 100755 --- a/lgsm/modules/command_restart.sh +++ b/lgsm/modules/command_restart.sh @@ -20,6 +20,9 @@ if [ -n "${playersonline}" ]; then date '+%s' > "${lockdir:?}/${selfname}-restart-request.lock" core_exit.sh fi +# Clear any pending restart request now that the restart is actually proceeding, +# so a stale lock doesn't trigger a repeat restart on the next monitor run. +rm -f "${lockdir:?}/${selfname}-restart-request.lock" exitbypass=1 command_stop.sh command_start.sh