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

35 lines
727 B
SYSTEMD
Raw Normal View History

2020-12-28 12:27:18 -06:00
#
# 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
2020-12-28 12:27:18 -06:00
PrivateUsers=true
ProtectSystem=full
ProtectHome=true
# Implies MountFlags=slave
ProtectKernelTunables=true
# Implies NoNewPrivileges=yes
ProtectKernelModules=true
# Implies MountAPIVFS=yes
ProtectControlGroups=true
2021-01-24 20:27:17 -06:00
ExecStart={{ minecraft_home }}/%i/start-server.sh
ExecStop={{ minecraft_home }}/%i/stop-server.sh
2020-12-28 12:27:18 -06:00
Restart=always
# Restart after 24hrs
RuntimeMaxSecs=86400
[Install]
WantedBy=multi-user.target