Page 1 of 1

Headless Server: auto-quit when empty, for cloud setups

Posted: Sat Sep 23, 2023 4:14 am
by Lizzy
TL;DR
Create a configuration to automatically close the server when there are no players (after some sane waiting).

What ?
A while ago, I wrote a Python script that will track the number of players in the server and shuts it down after a wait if no one comes back. There is a much longer grace period at startup, too.

That worked okay, but now I'm revisiting this entire project as my friends and I are coming back to the game… and considering my Discord integration wasn't very useful because we just met same time every week, I feel like I can simplify my entire Python code away… except for that player tracker.

So I come here to ask, maybe add something like that to server-settings.json?

I would suggest:
"automatically_quit_server_when_empty": bool,
"autoquit_startup_grace_minutes": float,
"autoquit_drain_grace_minutes": float,

(This is surprisingly difficult to search, so sorry if this is a dupe, I really tried!)
Why ?
On cloud setups I can write a simple bash scripts that starts the server, and then backs up the saves and terminates when the game quits. Very practical!