Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: monitor does not detect updates started with the `u` short alias

Chiusa Adatta ai principianti
#4,997 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash
Ambito
cli

Direzione di ricerca

Il controllo si trova in fn_monitor_check_update in lgsm/modules/command_monitor.sh, intorno alla riga 168. La lista degli alias è definita in core_getopt.sh (cmd_update="u;update"), e la corrispondenza dei processi in quella funzione copre solo i nomi lunghi. Per riprodurre, eseguire fn_monitor_check_update con update.lock presente mentre è in esecuzione un processo la cui riga di comando è /bin/bash ./testserver u. È completato quando u ottiene lo stesso risultato SKIP di update e i controlli esistenti di update, validate e restart continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

command: monitor command: update info: steamcmd reproducible: always severity: medium type: bug
Severity

severity: medium

Reproducibility

reproducible: always

Regression

regression: no

Affects latest release

latest-release: yes

User story

As a game server administrator, I want monitor to leave my server alone while an update started with ./gameserver u is running, so that it does not restart the server in the middle of the update.

Script name

Any (e.g. vhserver)

Game

Any (not game specific)

Linux distro

Other

Command

command: monitor, command: update

Expected behavior

While ./gameserver u is running and lock/update.lock exists, monitor prints Checking update: LinuxGSM is updating the game server and exits, as it already does for ./gameserver update.

Actual behavior

Monitor does not detect the update and continues. Because the update has stopped the server, fn_monitor_check_session reports Checking session: FAIL, sends a monitor-session alert and runs command_restart.sh, which starts the server while SteamCMD is still updating it.

Further information

core_getopt.sh defines the update command as cmd_update=("u;update" ...), so ./gameserver u and ./gameserver update run the same update.

fn_monitor_check_update in lgsm/modules/command_monitor.sh (line 168) only skips monitoring when update.lock exists and an update process is found with pgrep -fcx. It checks the command lines for update, validate, v, force-update, fu, update-restart and ur, but not for u. pgrep -x needs an exact match, so /bin/bash ./gameserver u is not found, pgrep returns 0 and the update lock is ignored.

During a SteamCMD update that has to stop the server, update_steamcmd.sh calls command_stop.sh with exitbypass=1. The stop keeps ${selfname}-monitoring.lock because the first command is UPDATE, not STOP. The next monitor run (cron, typically every 5 minutes) therefore gets past the lockfile check and restarts the server.

The u alias has been missing since this check was added in 9d699ee3 (2023).

Suggested fix: add || "$(pgrep -fcx -u "${USER}" "/bin/bash ./${selfname} u")" != "0" to the condition. I will open a PR for it.

Pre-checks
  • I ran update and validate before reporting this issue.

Found by reading the code on the current develop branch (28b1d67d) and reproduced with the module function itself, see the steps and output below.

Relevant log output
# fn_monitor_check_update from develop (28b1d67d), update.lock present,
# while "/bin/bash ./testserver <command>" is running:
command          result
update           SKIP (update detected)
u                CONTINUE (monitor proceeds)   <-- bug
validate         SKIP (update detected)
v                SKIP (update detected)
force-update     SKIP (update detected)
fu               SKIP (update detected)
update-restart   SKIP (update detected)
ur               SKIP (update detected)
Steps to reproduce
  1. Install any SteamCMD game server (e.g. vhserver) and start it, so the monitoring lockfile exists.
  2. Run ./vhserver u while an update is available, so the server gets stopped for the update.
  3. While SteamCMD is still downloading, run ./vhserver monitor (or let the monitor cron job run).
  4. Monitor reports Checking session: FAIL, sends a monitor-session alert and restarts the server during the update.
  5. Repeat with ./vhserver update: monitor reports Checking update: LinuxGSM is updating the game server and exits.

🤖 Generated with Claude Code

Lingua principale
Shell
Stelle
4.9k
Fork
870
Merge medio
20h 36m
PR unite (30g)
105

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GameServerManagers/LinuxGSM

Tutte le issue di GameServerManagers/LinuxGSM

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.