ansible/roles/minecraft-paper/templates/paper@.service
Salt abb8090c9b Add new host and enroll it in Paper
Note: currently untested, hopefully shit Just Werks
2020-10-10 22:44:17 -05:00

40 lines
1.0 KiB
Desktop File

#
# Licensed under the terms of the MIT license
# Source: https://github.com/agowa338/MinecraftSystemdUnit/
# vim:ft=dosini:
#
[Unit]
Description=Paper Minecraft Server %i
After=network.target
[Service]
User=minecraft
Group=mc-admin
WorkingDirectory={{ paper_home }}/%i
PrivateUsers=true
ProtectSystem=full
ProtectHome=true
# Implies MountFlags=slave
ProtectKernelTunables=true
# Implies NoNewPrivileges=yes
ProtectKernelModules=true
# Implies MountAPIVFS=yes
ProtectControlGroups=true
ExecStart=/bin/sh -c '/usr/bin/screen -DmS %i /usr/bin/java -Xms{{ paper_jre_xms }} -Xmx{{ paper_jre_xmx }} -jar server.jar nogui'
ExecReload=/usr/bin/screen -p 0 -S %i -X eval 'stuff "reload"\\015'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "say {{ paper_stopmessage }}"\\015'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "save-all"\\015'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "stop"\\015'
ExecStop=/bin/sleep 5
Restart=always
# Restart after 24hrs
RuntimeMaxSecs=86400
[Install]
WantedBy=multi-user.target