feat(stop): add option to only stop server if no players (#4595)
* add no stop if players online
* remove dev message
* monitor will now restart the server if requested earlier
* changed var name
* add npm check to install gamedig
* new line
* add var
* remove from non supported servers
* typo
* word
* move restart request
* change lock file name
* restart and monitor
* refactor(stop): share player-online check + add stoponlyifnoplayersallcommands
- Extract the duplicated gamedig player-count query (previously copy-pasted
in command_stop, command_restart and command_monitor) into a new shared
check_players_online.sh module that sets ${playersonline}; registered in
core_modules.sh.
- Add stoponlyifnoplayersallcommands (default on) so the stoponlyifnoplayers
protection applies to every command that stops the server (e.g. update).
Set to off to limit it to explicit stop/restart, allowing update to stop
the server even while players are online.
- Add the new setting to all game server _default.cfg files.
- Resolve merge with develop (check_gamedig now keeps develop's npm-update
branch plus the 'install Node.js' hint).
* fix(stop): clear stale restart-request lock + warn on failed player query
Addresses Copilot review feedback on #4595:
- command_restart.sh: clear the *-restart-request.lock once a restart
actually proceeds. Previously the lock was only written when postponing
and never removed, so every subsequent monitor run would see the stale
lock and trigger a repeat restart indefinitely. Fixed and verified against
a live server: postponed restart -> monitor executes it and clears the
lock -> a second monitor run no longer restarts.
- check_players_online.sh: if the gamedig query fails for every configured
IP (e.g. gamedig/jq missing), playersonline now still fails open (so a
broken query can't permanently block stop/restart) but prints a clear
warning that the safety check could not run, instead of silently
behaving as if the server were empty.