Skip to content

Commit 103eeaf

Browse files
authored
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.
1 parent 51ad60e commit 103eeaf

140 files changed

Lines changed: 628 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lgsm/config-default/config-lgsm/ahl2server/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ telegramthreadid=""
107107
telegramsilentnotification="false"
108108
curlcustomstring=""
109109

110+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
111+
stoponlyifnoplayers="off"
112+
stoponlyifnoplayersallcommands="on"
113+
110114
## Updating | https://docs.linuxgsm.com/commands/update
111115
updateonstart="off"
112116

lgsm/config-default/config-lgsm/ahlserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ telegramthreadid=""
102102
telegramsilentnotification="false"
103103
curlcustomstring=""
104104

105+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
106+
stoponlyifnoplayers="off"
107+
stoponlyifnoplayersallcommands="on"
108+
105109
## Updating | https://docs.linuxgsm.com/commands/update
106110
updateonstart="off"
107111

lgsm/config-default/config-lgsm/arkserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ telegramthreadid=""
104104
telegramsilentnotification="false"
105105
curlcustomstring=""
106106

107+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
108+
stoponlyifnoplayers="off"
109+
stoponlyifnoplayersallcommands="on"
110+
107111
## Updating | https://docs.linuxgsm.com/commands/update
108112
updateonstart="off"
109113

lgsm/config-default/config-lgsm/arma3server/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ telegramthreadid=""
118118
telegramsilentnotification="false"
119119
curlcustomstring=""
120120

121+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
122+
stoponlyifnoplayers="off"
123+
stoponlyifnoplayersallcommands="on"
124+
121125
## Updating | https://docs.linuxgsm.com/commands/update
122126
updateonstart="off"
123127

lgsm/config-default/config-lgsm/armarserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ telegramthreadid=""
103103
telegramsilentnotification="false"
104104
curlcustomstring=""
105105

106+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
107+
stoponlyifnoplayers="off"
108+
stoponlyifnoplayersallcommands="on"
109+
106110
## Updating | https://docs.linuxgsm.com/commands/update
107111
updateonstart="off"
108112

lgsm/config-default/config-lgsm/atsserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ telegramthreadid=""
9595
telegramsilentnotification="false"
9696
curlcustomstring=""
9797

98+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
99+
stoponlyifnoplayers="off"
100+
stoponlyifnoplayersallcommands="on"
101+
98102
## Updating | https://docs.linuxgsm.com/commands/update
99103
updateonstart="off"
100104

lgsm/config-default/config-lgsm/avserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ telegramthreadid=""
9595
telegramsilentnotification="false"
9696
curlcustomstring=""
9797

98+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
99+
stoponlyifnoplayers="off"
100+
stoponlyifnoplayersallcommands="on"
101+
98102
## Updating | https://docs.linuxgsm.com/commands/update
99103
updateonstart="off"
100104

lgsm/config-default/config-lgsm/bb2server/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ telegramthreadid=""
108108
telegramsilentnotification="false"
109109
curlcustomstring=""
110110

111+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
112+
stoponlyifnoplayers="off"
113+
stoponlyifnoplayersallcommands="on"
114+
111115
## Updating | https://docs.linuxgsm.com/commands/update
112116
updateonstart="off"
113117

lgsm/config-default/config-lgsm/bbserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ telegramthreadid=""
102102
telegramsilentnotification="false"
103103
curlcustomstring=""
104104

105+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
106+
stoponlyifnoplayers="off"
107+
stoponlyifnoplayersallcommands="on"
108+
105109
## Updating | https://docs.linuxgsm.com/commands/update
106110
updateonstart="off"
107111

lgsm/config-default/config-lgsm/bdserver/_default.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ telegramthreadid=""
102102
telegramsilentnotification="false"
103103
curlcustomstring=""
104104

105+
## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
106+
stoponlyifnoplayers="off"
107+
stoponlyifnoplayersallcommands="on"
108+
105109
## Updating | https://docs.linuxgsm.com/commands/update
106110
updateonstart="off"
107111

0 commit comments

Comments
 (0)