Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

systemd dependency should be removed #22

Open
jamiemtdwyer opened this issue Feb 3, 2022 · 7 comments
Open

systemd dependency should be removed #22

jamiemtdwyer opened this issue Feb 3, 2022 · 7 comments

Comments

@jamiemtdwyer
Copy link
Contributor

jamiemtdwyer commented Feb 3, 2022

The restartserver command assumes you are using systemd to manage your Zomboid service. It also makes pretty liberal assumptions about what the name of this systemd daemon is.

IMO, this code should be removed entirely for the following reasons:

  • limits the audience for the bot, because systemd becomes an explicit dependency if you are running the bot on gnu/linux
  • there shouldn't actually be any requirement to restart your service. if your Zomboid service is set to Restart=always in your systemd config for your process, the server will restart automatically when it exits via quit.
  • if the server takes more than 5 seconds to save, you are risking data being lost or corrupted due to the process exiting early (re-reading the code, I don't actually think this is true, but there could be edge cases that lead to this scenario)
@jamiemtdwyer jamiemtdwyer changed the title systemddependency should be removed systemd dependency should be removed Feb 3, 2022
@rfalias
Copy link
Owner

rfalias commented Feb 3, 2022

Issuing 'quit' from rcon still leaves the server half way up, thus the service restart.
Perhaps allowing a specific restart command to be specified in .env would be a fair compromise? The server still needs a final kick after the quit command runs, if that's killing it nicely with SIGHUP or issuing systemctl restart.

Now I'm not a fan of allowing commands to be run from user specified arguments, but in this case it's probably not an issue since the python code has to be run by some sort of admin anyways.

Interested to hear your input.

@jamiemtdwyer
Copy link
Contributor Author

jamiemtdwyer commented Feb 4, 2022 via email

@rfalias
Copy link
Owner

rfalias commented Feb 4, 2022

Are you sending 'quit' via rcon? It works if I manually type it in, but rcon quit leaves the screen/game console running even if it's unresponsive to further commands

@Rysanlos
Copy link

Rysanlos commented Feb 4, 2022

I have indeed changed this line of code too because I'm not using systemd for project zomboid but linuxgsm

@rfalias
Copy link
Owner

rfalias commented Feb 4, 2022

So maybe an option to specify your restart command would work?

@jamiemtdwyer
Copy link
Contributor Author

Issuing 'quit' from rcon still leaves the server half way up, thus the service restart.

That's strange, I'm not able to replicate this behaviour on my end. I use a cronjob to quit the server via rcon, and the server exits.

In order to preserve this behaviour for your sake, maybe can make the whole restart block a conditional based on an ENV flag, and have another ENV flag indicate which restart command to run.

@rfalias
Copy link
Owner

rfalias commented Feb 9, 2022

I'll update this soon. I did get rid of the rcon binary dep though so that's something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants