Dedicated Server setup and management with GSM

For those that have used GSM (Game Server Manager) before - or those that haven't, I have just uploaded a guide to dedicated server setup utilising it.

Those that host dedicated servers will find a lot of useful things here, such as auto-updating, timed restarts and backups and a wealth of other things to make managing your server easier. GSM has been in continuous development for around 5 years, seeing countless improvements and additions. It also features a companion DiscordBot, to manage your server remotely.

The guide:

https://steamcommunity.com/sharedfiles/filedetails/?id=2396422784

For those that are unaware of some of the features of GSM, here is a run-down:

Game Server Manager features - an overview
- Automatic update checking and applying via SteamCMD (with configurable delay and server warning message)
- Players online graph
- Built-in Telnet and RCON client, which can be used manually or set to automatically send messages and commands (such as shutdown and shutdown notices) to the server
- Auto-restart if server goes down
- Message/command broadcast system
- Player list showing everyone online, including ping, score, team and time online.
- INI File Parser, which displays a list of all ini file settings (across multiple files) in a list that you can sort, filter, edit, import and export as you wish.
- CPU and RAM usage display, with graph
- Network bandwidth monitor, with graph
- Ability to output status, players online and server name to a file - formatted however you want
- Single-click access to configuration.
- Detailed server information
- Internal and external IP address display
- Server up-time display
- Optional timed daily server restart.
- Timed incremental backups. Perform a daily backup of game data to a zip file.
- Automatically update game - Ability to run a maintenance / update program between restarts. e.g. SteamCMD to perform daily updates automatically. The server will start back up again when this program finished / ends so you minimise downtime.
- Option to delay timed restarts. i.e. The server will be turned off and the program will wait X seconds before attempting to restart it.
- Telnet to server
- 1 click backup and maintenance
- Remote commands to start, stop, backup, update and send commands to your server.
- Game Profiles - Multiple instances of the program can be run with multiple configurations.
- Designed to be "universal" and work with a multitude of games.
6:13 pm, February 17, 2023
jimbobslimbob 0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM March 3, 2021 @ 11:56:47 pm PST

Originally posted by frostyfire03530:
Thank you for the response! Another couple of quick questions if you don't mind me asking, does GSM and the GSM Discord Bot have options in settings to start on Windows boot? I didn't see one, just making sure if I just need to dump a shortcut to the "Startup" folder or make a scheduled task, etc.

Currently not - so go ahead and add a startup shortcut. Come to think of it, I don't know why this wasn't added years ago. I will try and get it in the next version.

Originally posted by frostyfire03530:
Also, I'm not for sure if I missed it in the GSM Discord Bot documentation, but is there any !status query to return if the server is Online?
There is no status query, but you are able to get GSM to send logs directly to Discord, which could achieve roughly the same kind of thing.
6:13 pm, February 17, 2023
0 comments 0 likes

Jabraham replied to Dedicated Server setup and management with GSM February 19, 2021 @ 9:56:45 pm PST

Hi Jimbob,

It's early days using GSM but so far it's not bad. I have an issue with the Discord bot though constantly disconnecting. I haven't been able to use 1 command yet. Any advice?

Also on a side note, I can't shut down a server which has been run with a batch script, even forcefully. It'd also be nice to be able to pipe the output to a log file by allowing us to do something like:

server.exe -param value > server.log

6:13 pm, February 17, 2023
0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM February 20, 2021 @ 3:16:26 am PST

Hi - glad you are finding use in the program! As to your questions:

1. As long as the bot reconnects ok, it normally manages disconnects itself - which can happen. The bot needs to be set up. A good resource for that is here: https://discordpy.readthedocs.io/en/latest/discord.html

2. If you are not selecting an executable for your server (and instead a batch file), then you must tell GSM what the executable/process is that it needs to interact with via the "monitoring" tab - at the bottom. Click the "..." and select your "cmd.exe" - normally located in "C:\Windows\System32\cmd.exe". This is what batch files run. It's not the recommended way to do things, since the cmd.exe can be open by any number of other applications on a machine - and GSM cannot then distinguish between them - but it's totally do-able if you want to go down this route. Otherwise, it's normally better to select the server executable itself and add the commands in the relevant section there instead of using a batch file. Your choice, of course.

3. An interesting idea. I will add it to my list for potential improvements.
6:13 pm, February 17, 2023
0 comments 0 likes

Jabraham replied to Dedicated Server setup and management with GSM February 20, 2021 @ 8:27:47 am PST

Thanks for the quick reply!

1. The GSM Discord Bot never reconnects, it shows as connected for around 10 seconds and then always shows "Connection lost" and logs "Disconnected" until it restarts itself, then the same thing happens.

The bot is correctly set up from those directions as far as I can tell. If I give the bot the wrong token, it errors with a 401 (just checking it's picking up errors), so unless there's a different error being thrown when it's using the correct token that it's not logging or displaying, I'm a bit stuck.

1.b. Side note, can the Discord Bot handle multiple servers ran with GSM?

2. Thanks, I'd completely missed that part of the description. I'll get my batch script to "start" the exe instead of running it directly.
6:13 pm, February 17, 2023
0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM February 20, 2021 @ 11:26:44 am PST

Strange indeed. Is there anything that could be interfering with or causing packet loss/general bad connection?

The bot can be invited to any number of servers and work the same in each. As long as permissions and channels match, no problem.
6:13 pm, February 17, 2023
0 comments 0 likes

Jabraham replied to Dedicated Server setup and management with GSM February 20, 2021 @ 3:58:54 pm PST

No, not that I know. I'd even opened up the firewall to allow the program. I added a different bot which works fine but obviously doesn't have the same functionality of controlling the server which is what I'm after.
6:13 pm, February 17, 2023
0 comments 0 likes

Caerpre replied to Dedicated Server setup and management with GSM February 26, 2021 @ 2:12:52 am PST

Absolutely loving GSM. The whole package really helps me take control over my server management.
I'm having one issue however and I can't figure out how to resolve it. Currently everything about running the server works perfectly and I've set it to do automatic updates using SteamCMD. This also works as intended as best I can tell. However when an automatic update occurs the server does not restart as it's meant to. It shuts down the server, connects to SteamCMD, updates the server, closes SteamCMD, and then just hangs...
GSM says "Performing Maintenance" and "Waiting for Update to Finish" but it never proceeds beyond that point. I have to close GSM, reopen it and then start up the server. Which sort of defeats part of the point of automatic updates since I'm still manually restarting the server every time.

Am I doing something wrong?
6:13 pm, February 17, 2023
0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM February 26, 2021 @ 2:26:42 am PST

Hi - glad you are finding it useful.

What you describe is certainly not normal behaviour. Could be caused by a number of things - hopefully not a bug, but if it is I will have to look into it.

How long is your server monitor cycle? It defaults to 30 seconds. If you have entered a larger number then the maintenance may wait until the next cycle before attempting to start the server again.

I take it that starting the server manually via GSM works ok? If it does then that eliminates a config issue there.

If you have a lengthy shutdown delay time, then that may also cause a hang for that length of time. This is there so that the server can perform any saves before GSM does other things. Slower machines generally require longer delays.

If you click "Perform maintenance", does it work correctly that way?
6:13 pm, February 17, 2023
0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM February 26, 2021 @ 2:32:42 am PST

Originally posted by MisplacedfaceTTV:
No Anti cheat though?
GSM is designed to work with most games and does not have specific game anti-cheat as that would require programming for each individual game... not really the scope of this program. Ideally, each game should have that built-in. Hopefully as Valheim develops, they will add it in some form.
6:13 pm, February 17, 2023
0 comments 0 likes

Subudai replied to Dedicated Server setup and management with GSM February 26, 2021 @ 3:19:47 pm PST

Originally posted by Caerpre:
Absolutely loving GSM. The whole package really helps me take control over my server management.
I'm having one issue however and I can't figure out how to resolve it. Currently everything about running the server works perfectly and I've set it to do automatic updates using SteamCMD. This also works as intended as best I can tell. However when an automatic update occurs the server does not restart as it's meant to. It shuts down the server, connects to SteamCMD, updates the server, closes SteamCMD, and then just hangs...
GSM says "Performing Maintenance" and "Waiting for Update to Finish" but it never proceeds beyond that point. I have to close GSM, reopen it and then start up the server. Which sort of defeats part of the point of automatic updates since I'm still manually restarting the server every time.

Am I doing something wrong?

I was having the same issue but eventually figured out how to fix it.
First some information from the Valheim Dedicated Server Manual PDF that is included in the dedicated server folder:

Originally posted by Valheim Dedicated Server Manual:
When you wish to stop running the server, ​it is important that you close it by pressing CTRL+C in the Command-window​. If you close it by clicking the X in the window frame the Server may keep running in the background, we don’t really know!

Now with that information in mind, make sure you do not have any instances of the CMD window running by right-clicking the Windows taskbar and shut down any instances of CMD that is running. (I had two instances running that I forced closed.)

Now, to fix this in GSM head to Program Settings and navigate to Server Shutdown. Tick the box that says Send keys to shutdown the server: and inside the box you type in ctrl+c

Save & Close and you are done.
Click the Perform Maintenance button and GSM should look for updates, apply, restart and all that without hanging.

I hope this solves your issue as well!
6:13 pm, February 17, 2023
0 comments 0 likes

Caerpre replied to Dedicated Server setup and management with GSM February 26, 2021 @ 3:32:57 pm PST

Originally posted by Subudai:
Now, to fix this in GSM head to Program Settings and navigate to Server Shutdown. Tick the box that says Send keys to shutdown the server: and inside the box you type in ctrl+c

Save & Close and you are done.
Click the Perform Maintenance button and GSM should look for updates, apply, restart and all that without hanging.

I hope this solves your issue as well!

This appears to have fixed it up. I must've looked at that a hundred times and not thought to include it in the parameters. Thank you for the help.
6:13 pm, February 17, 2023
0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM February 26, 2021 @ 4:18:29 pm PST

Glad you guys found a way around the issue. As another thought, I wrote above in regards to a similar issue posted by another user, it's worth noting that:

Originally posted by jimbobslimbob:
If you are not selecting an executable for your server (and instead a batch file), then you must tell GSM what the executable/process is that it needs to interact with via the "monitoring" tab - at the bottom. Click the "..." and select your "cmd.exe" - normally located in "C:\Windows\System32\cmd.exe". This is what batch files run. It's not the recommended way to do things, since the cmd.exe can be open by any number of other applications on a machine - and GSM cannot then distinguish between them - but it's totally do-able if you want to go down this route. Otherwise, it's normally better to select the server executable itself and add the commands in the relevant section there instead of using a batch file. Your choice, of course.
6:13 pm, February 17, 2023
0 comments 0 likes

frostyfire03530 replied to Dedicated Server setup and management with GSM February 27, 2021 @ 6:48:56 pm PST

@jimbobslimbob, wonderful tool, thank you for it!
Do you know if Valheim can be configured to use any of the server telnet/rcon commands? I've done some searching, but can't find any info. Since you were familiar with how other games have implemented it, I was curious.
6:13 pm, February 17, 2023
0 comments 0 likes

jimbobslimbob replied to Dedicated Server setup and management with GSM February 28, 2021 @ 2:05:17 am PST

I am not aware of any current implementation in Valheim. If something gets added i will update the guide.
6:13 pm, February 17, 2023
0 comments 0 likes

frostyfire03530 replied to Dedicated Server setup and management with GSM March 3, 2021 @ 9:43:36 pm PST

Thank you for the response! Another couple of quick questions if you don't mind me asking, does GSM and the GSM Discord Bot have options in settings to start on Windows boot? I didn't see one, just making sure if I just need to dump a shortcut to the "Startup" folder or make a scheduled task, etc.

Also, I'm not for sure if I missed it in the GSM Discord Bot documentation, but is there any !status query to return if the server is Online?
6:13 pm, February 17, 2023
0 comments 0 likes