rfalias / project_zomboid_bot

Discord bot for managing your PZ server.
18 stars 7 forks source link

systemd dependency should be removed #22

Open jamiemtdwyer opened 2 years ago

jamiemtdwyer commented 2 years ago

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:

rfalias commented 2 years ago

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 commented 2 years ago

Hmm, in my server environment (Ubuntu 20.04), issuing the quit command saves the world, disconnects all clients and then exits. The service is then automatically restarted via Autorestart=true.

On Thu, Feb 3, 2022, 7:55 AM RFAlias @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/rfalias/project_zomboid_bot/issues/22#issuecomment-1028961422, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD2DWPGKONGMUVPBONMLUDTUZJ3MHANCNFSM5NNRW23A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

rfalias commented 2 years ago

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 commented 2 years ago

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

rfalias commented 2 years ago

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

jamiemtdwyer commented 2 years ago

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 commented 2 years ago

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