Open mrskizzex opened 5 months ago
You can shut it down when idle, the question is how do you start it back up when a client connects? You would need some sort of UDP listener/socket handler that waits for incoming clients, puts them in some sort of waiting state while the server starts, so the Windows client doesn't timeout, and then hand over the connection to the Valheim server. You could also try something like systemd socket activation and maybe it would work out. Depends on how the client behaves when the server doesn't react immediately. For TCP services that's easier as you can delay the handshake. For UDP I'm guessing the client would just assume that its packets got lost fairly quickly. So you'd likely have to implement parts of the Valheim server protocol.
Would it be possible to add either a feature in the title as an environmental variable or simply add a feature where you can add your own cron entry?
I crudely edited valheim's user crontab and added:
which works but It will probably not survive container updates.
I exposed supervisor page behind 2fa auth to my friends who can start the server if needed but I want to also shut down the server if there is no one on the server for more than 15-30 minutes to save resources.