GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.22k stars 803 forks source link

[TF2] Not catching 'quit' or '_restart" #941

Closed Luc1f3rUK closed 7 years ago

Luc1f3rUK commented 8 years ago

I've noticed today that the script doesn't seem to be catching the 'quit' or '_restart' commands. This is a big issue as I have all my servers restart at 2AM to prevent performance hitches.

If you run any of those commands, the server just shuts down and the tmux session ends.

Any help would be appreciated. Thanks, Ryan.

UltimateByte commented 8 years ago

Do you mean ./tf2server restart does not work ?

UltimateByte commented 8 years ago

You're trying to restart from the tmux session aka console ? Maybe some read would help https://github.com/dgibbs64/linuxgsm/wiki/Start-Stop-Restart-commands

Luc1f3rUK commented 8 years ago

@UltimateByte Yeah. From within the console. The script used to catch when this happened, kept the tmux session open then started the server back up, Doesn't seem to be doing it anymore.

UltimateByte commented 8 years ago

It happens if for some reason there is already a typed text in your console as a "stop" or "restart" command from LGSM will try to input "quit" to the server's console.

UltimateByte commented 8 years ago

So can we consider this as solved ?

Luc1f3rUK commented 8 years ago

No. The script isn't catching the restart command. This has happened every time I tried it (after starting the server back up from a quit). It is a script related issue.

When you type 'quit' in console, the script is supposed to keep the tmux session open then restart the server. It's the crash protection. If the server crashes, it won't come back up.

I have a SourceMod plugin that executes _restart in console, but the srcds instance within tmux isn't restarted, it quits. If it were working properly, the console wouldn't close and the server would say "Server restarting in 10 seconds".

That's the issue.

Luc1f3rUK commented 8 years ago

I run 8 gameservers on one Linux box, but under different users. (tf2server thru 8) tf2server (1) does this correctly: https://gyazo.com/06c7975c19445fb012d6572774eb9f67

Instead of this happening, it exits on all but no.1. Could there be an issue with servers running under different users?

dgibbs64 commented 8 years ago

The quit command depends upon the server. Some servers quit means shutdown and others its means restart. Should quit mean shutdown the tmux session normally closes as it kills the process. However if quit means restart the process is kept alive and the tmux session is not closed.

Quit meaning restart is a bit of a pain imo as when the server is stopped LGSM sends the quit command to to a graceful shutdown. However the server instead just starts itself back up (Insurgency is an example) meaning stop will take over 30 seconds.

Servers running under different users are separate and should have no bearing on each other.

The issue does not sound like a problem with LGSM to me but rather the server or plugins you are using.

If you have setup LGSM to monitor the server even if the server was killed it will be back online within a few mins.

I hope this explanation helps you a little

UltimateByte commented 8 years ago

Yeah, from your last screenshot, the server IS catching the quit command, but the game server just happens to restart instead for some reason. Garry's Mod did the same at one point, it wasn't a plugin issue, it was gmod itself, so we had to complain about it on their github in order for them to correct it. But some addons might cause that too.

If you wanna restart and you're in a hurry, you can also force close the server before using the restart command. For that, you can kill the pid, but finding it is kinda boring, so I usually run ./gameserver console, then press ctrl + c. to terminate the process Then ./gameserver restart.

Luc1f3rUK commented 8 years ago

That's unusual. The TF2 servers running on that box are all direct clones of eachother.

I also have 2 other seperate dedicated servers with 8 servers on, and the first server (tf2server) on those boxes acts the same way as the above screenshot and the others exit.

This is becoming more strange every time I think about it.

Luc1f3rUK commented 8 years ago

We've deployed the monitor system through a cron job for every 5 mins. (Not sure why I didn't do this a while back)

All my servers go down for updates automatically (plugin detects a Steam update and restarts the server) I guess the monitor will bring them back up if they don't on their own.

Still doesn't explain the issue.

UltimateByte commented 8 years ago

"All my servers go down for updates automatically (plugin detects a Steam update and restarts the server)"

What if this update plugin fucks things up ? Why are you even using a plugin for that if you can run LGSM's update checker as a cronjob ? :p https://github.com/dgibbs64/linuxgsm/wiki/Update

Edit : (sorry for closing, misclick)

UltimateByte commented 7 years ago

Well, closing as isolated issue and no feedback.

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.