Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng Phù hợp với người mới
#4,997 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash
Lĩnh vực
cli

Hướng nghiên cứu

Kiểm tra nằm trong fn_monitor_check_update ở lgsm/modules/command_monitor.sh, khoảng dòng 168. Danh sách alias được định nghĩa trong core_getopt.sh (cmd_update="u;update"), và phần so khớp tiến trình trong hàm đó chỉ bao phủ các tên dài. Để tái hiện, chạy fn_monitor_check_update khi update.lock tồn tại và có một tiến trình với dòng lệnh /bin/bash ./testserver u đang chạy. Hoàn thành khi u nhận cùng kết quả SKIP như update, và các kiểm tra update, validate và restart hiện có vẫn pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Shell
Star
4.9k
Fork
870
Merge trung bình
14 giờ 50 phút
Pull request đã merge (30 ngày)
109

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GameServerManagers/LinuxGSM

Tất cả issue của GameServerManagers/LinuxGSM

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.