Skip to content

fix(monitor): detect updates started with the u short alias - #4998

Closed
borzaka wants to merge 1 commit into
GameServerManagers:developfrom
borzaka:fix/monitor-update-short-alias
Closed

borzaka wants to merge 1 commit into
GameServerManagers:developfrom
borzaka:fix/monitor-update-short-alias

Conversation

@borzaka

@borzaka borzaka commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Description

fn_monitor_check_update in lgsm/modules/command_monitor.sh skips monitoring when lock/update.lock exists and an update process is running. It finds the update process with pgrep -fcx against the command lines update, validate, v, force-update, fu, update-restart and ur, but not u, although core_getopt.sh defines the update command as cmd_update=("u;update" ...).

Because pgrep -x needs an exact match, an update started with ./gameserver u is not found and monitor carries on. During a SteamCMD update that stops the server, the stop keeps ${selfname}-monitoring.lock (the first command is UPDATE, not STOP). So the next monitor run reports Checking session: FAIL, sends a monitor-session alert and runs command_restart.sh while SteamCMD is still updating the server.

This PR adds the missing "/bin/bash ./${selfname} u" check next to the update check. Only lgsm/modules/command_monitor.sh is changed.

Fixes #4997

Type of change

  • Bug fix (a change which fixes an issue).
  • New feature (a change which adds functionality).
  • New Server (new server added).
  • Refactor (restructures existing code).
  • Comment update (typo, spelling, explanation, examples, etc).

Testing

Please list the exact validation you performed and the outcome.

  • Commands/tests run:

    • Extracted fn_monitor_check_update from both develop (28b1d67) and this branch, stubbed the print/log helpers and core_exit.sh, and ran it with update.lock present while a real /bin/bash ./testserver <command> process was running, for every update related command.
    • Ran the same check with no matching process, and with update.lock missing.
    • Checked for false positives with /bin/bash ./testserver ul, update-lgsm, uf and u extra running.
    • bash -n lgsm/modules/command_monitor.sh and shellcheck 0.11.0 with the repository's .shellcheckrc.
    • Not run: a full update and monitor cycle on an installed game server.
  • Result:

    Running command develop This branch
    update skip (update detected) skip (update detected)
    u monitor continues skip (update detected)
    validate, v, force-update, fu, update-restart, ur skip (update detected) skip (update detected)
    lock present, no update process monitor continues monitor continues
    u running, no lock monitor continues monitor continues
    ul, update-lgsm, uf, u extra running, lock present monitor continues monitor continues

    No bash -n or shellcheck findings.

  • Environment used (distro/version): Ubuntu 22.04.5 LTS, bash 5.1.16, procps-ng 3.3.17.

Risk and rollback

  • Risk level: low. One more exact-match pgrep check in an existing condition; other commands and the stale lockfile handling are unchanged.
  • Rollback plan: revert this commit.

Breaking changes

  • No breaking changes.
  • Breaking changes included (describe below).

Documentation impact

  • No documentation update required.
  • User documentation update required.
  • Developer documentation update required.

Checklist

PR will not be merged until all steps are complete.

  • This pull request links to an issue.
  • This pull request uses the develop branch as its base.
  • This pull request subject follows the Conventional Commits standard.
  • This code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have provided a detailed enough description of this PR.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

🤖 Generated with Claude Code

fn_monitor_check_update skips monitoring when update.lock exists and an
update process is running, but it did not check for the "u" alias of the
update command. While "./gameserver u" stopped the server for an update,
monitor saw no update process, reported the session as failed and
restarted the server during the update.

Fixes GameServerManagers#4997

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dgibbs64

Copy link
Copy Markdown
Member

Thanks @borzaka, and sorry: I merged #5002 with exactly this change without spotting that you'd already opened this PR (and #5000) for the issue you reported. Closing it as covered by #5002. You'll be credited for both fixes in the v26.3.0 release notes.

@dgibbs64 dgibbs64 closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants