ansible-role-minecraft/templates/minecraft@.service

35 lines
727 B
Desktop File

#
# Licensed under the terms of the MIT license
# Source: https://github.com/agowa338/MinecraftSystemdUnit/
# vim:ft=dosini:
#
[Unit]
Description=Minecraft Server %i
After=network.target
[Service]
User=minecraft
Group=minecraft
WorkingDirectory={{ minecraft_home }}/%i
EnvironmentFile={{ minecraft_home }}/%i/env
PrivateUsers=true
ProtectSystem=full
ProtectHome=true
# Implies MountFlags=slave
ProtectKernelTunables=true
# Implies NoNewPrivileges=yes
ProtectKernelModules=true
# Implies MountAPIVFS=yes
ProtectControlGroups=true
ExecStart={{ minecraft_home }}/%i/start-server.sh
ExecStop={{ minecraft_home }}/%i/stop-server.sh
Restart=always
# Restart after 24hrs
RuntimeMaxSecs=86400
[Install]
WantedBy=multi-user.target