Infinidoge / nix-minecraft

An attempt to better support Minecraft-related content for the Nix ecosystem
MIT License
172 stars 18 forks source link

module: wait for tmux to exit in stopScript #62

Closed Silveere closed 3 months ago

Silveere commented 3 months ago

This stops the server from being immediately force-killed by systemd. Any process not cleaned up by ExecStop is killed by systemd immediately after all ExecStop scripts exit.

This also changes the process detection, since $MAINPID doesn't seem to exist (at least from the perspective of the ExecStop script). I'm not sure if this is due to ProtectProc=invisible, something with systemd's PID detection, or something else entirely, but the new method seems to work.

Infinidoge commented 3 months ago

I honestly just took the $MAINPID method wholesale from the Terarria server implementation in Nixpkgs. I haven't been actively running Minecraft servers in a bit, so I just never noticed that this was an issue. Thanks for the fix!

Running the simple VM test works locally, so I'll go ahead and try to merge this later today after my exam.