Restarting servers through code?

i know there is a server management feature that lets you restart outdated servers, is there a way to do this through code?

For example, i want to update my round based game by restarting the servers, but the problem is that if i do them all at once, some servers will be restarted during an active round, which may make people angry.

So is there a way, for example, for me to trigger something through a command so that all servers will restart once their round ends, and eventually all servers are migrated to the newest version?

1 Like

This might be useful for what you’re trying to do

If thats not what youre looking for maybe you can have the same exact game as another experience in the asset manager and teleport a group of players from the first into the second one back and forth every new match

He probably means through the server management tool, when you select to restart servers, having an option to let the server/code decide when to restart instead of having it either instant or delayed.

At this moment this does not exist but it would definitely be an interesting suggestion

The server shuts down if everybody leaves for a while. So you can teleport everyone to newer servers with teleport service and then do the same for any new players that come into the server, and it will probably shut down in a minute

ya this was what i was thinking, i send the signal to restart old servers from server management tab, and then the servers wait until their round is over and then perform the restart

they could just be teleported to the exact same server, and then theoretically that could be an infinite loop, but i still could create reserved servers and then send people back to the main game, but i still think there is still room for error, so maybe there is another way? idk

They get kicked out again if they try to join the same server. If you only have a few servers you can probably retrieve them and manually select a good one to teleport to

ok but this is behaviour i want

  1. I press restart all outdated servers in server management tab
  2. outdated servers receive the signal and then WAIT until THEIR round is over
  3. server teleports everyone to a new server or kicks everyone or whatever you are suggesting
  4. game is eventually up to date after all server complete their rounds.

the problem is, as far as my knowledge goes, when i press restart ALL outdated servers, all servers receive the event right away and then fire their :BindToClose() function and there is no yield whatsoever, meaning it does not matter what state the game is in, it will forcefully reset the server.

so if im a player and im working so hard to win the round and then suddenly the game abruptly resets, i would be pretty upset, so is there a solution :smiling_face_with_tear:

Just use messaging services with a Verison ID any game not with that ID should wait until their round ends then soft shutdown.

1 Like