Saren-Arterius / minecraft-server-launcher

A Minecraft server(s) launcher written in Python
2 stars 1 forks source link

Can this use Restart=always safely? #2

Closed Leopere closed 1 year ago

Leopere commented 9 years ago

https://github.com/Saren-Arterius/minecraft-server-launcher/blob/3a567364ad616e43d8845b45023b11a63f2432e2/minecraft-servers.service

I've noticed there isn't a "Restart=" function defined https://wiki.archlinux.org/index.php/systemd#Using_units explains the usage of a "Restart=" function would this be possible? I think that it would be rather excellent if the service could recover itself.

Saren-Arterius commented 9 years ago

Well, actually I am not familiar with systemd scripts XD I will try to learn it myself, or just feel free to send a pull request.

Leopere commented 9 years ago

Apparently the "type=" option needs to be defined to something that isn't either type=forking or type=oneshot

This means that basically something using screenutil's won't work since that requires screen to run. Meaning the process is just started by systemd and then left to run in the background. Of course then also stopped by systemd later.

Saren-Arterius commented 9 years ago

This is what the launcher supposed to do, launching the screen and execute the minecraft servers. When SIGTERM is recieved, the wrapper (gracefully) stops the server. It's that dirty like you thought. :)

Leopere commented 9 years ago

I did a bit of digging around. https://gist.github.com/chamunks/fd2fe1aa66b4337bb346

I have also an untested systemd script that just boots the plain spigot.jar in a screen I built after some research.
https://gist.github.com/chamunks/ee6f5c5823cadec09db1#file-minecraft-service