Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't stop Rust server gracefully #4720

Open
HunterZ opened this issue Dec 21, 2024 · 6 comments
Open

[Bug]: Can't stop Rust server gracefully #4720

HunterZ opened this issue Dec 21, 2024 · 6 comments

Comments

@HunterZ
Copy link

HunterZ commented Dec 21, 2024

User story

As a rust server owner, I need LGSM to stop the server via a quit RCON command to trigger a clean save on exit

Game

Rust

Linux distro

Ubuntu 24.04

Command

command: stop

Further information

LGSM's default stopmode for Rust is CTRL+C, which causes a hard shutdown that tends to have nasty side effects like forgetting teams, because the server doesn't get a chance to generate a full save.

Changing stopmode to quit results in failure, apparently because LGSM tries to send it to the server console instead of via RCON.

Relevant log output

rustserver@ubuntultsvm:~$ ./rustserver stop
[ ERROR ] Stopping rustserver: Graceful: sending "quit": FAIL
[  OK  ] Stopping rustserver: LinuxGSM


### Steps to reproduce

1. Configure server for `stopmode=3`
2. `./rustserver start` and wait for server startup to complete
3. `./rustserver stop`
@rychannel
Copy link

Glad someone submitted this. Kept getting told I was doing it wrong even though I had tried every stop mode I thought made sense.

@dgibbs64 dgibbs64 moved this from 🆕 New Issues to 🏗 In Progress in LinuxGSM Backlog Mar 12, 2025
@dgibbs64
Copy link
Member

I am unsure on how to resolve this as LinuxGSM does not have RCON access to servers and Rust does not have an interactive console which we somtimes use. Different game servers have very different RCON protocols or none at all which adds a lot of complexity as I would need to add bespoke support for different game servers. Most game servers typically can handle graceful shutdown when CTRL+c or equivalent is triggered.

I only found 1 previous issue highlighting a similar issue but was closed due to inactivity. It would be great to get some input from other Rust admins to see if they also experience a similar issue and how they resolve it. If there are any suggestions I am happy to look at implementing if practical to do so.

@rychannel
Copy link

rychannel commented Mar 12, 2025 via email

@HunterZ
Copy link
Author

HunterZ commented Mar 12, 2025 via email

@atomy
Copy link

atomy commented Apr 7, 2025

I have a bash script using https://github.com/fieu/phust for rcon commands, it requires PHP though.
https://gist.github.com/atomy/9460458a319d32958f59736585b3ccd5

I am wondering how I can use it for graceful shutdown, any place where I can hook that in? Maybe create my own stopmode or something?

@atomy
Copy link

atomy commented Apr 8, 2025

So I added another stopmode and used my script, I tested it, it works quite well.

https://github.com/atomy/LinuxGSM/pull/1/files

However, the rcon tool I am using is not that great, it should probably be changed to https://github.com/gorcon/rcon-cli
Also this issue is relevant here if not even a dupe: #4419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In Progress
Development

No branches or pull requests

4 participants