37 lines
941 B
SYSTEMD
37 lines
941 B
SYSTEMD
|
#
|
||
|
# Licensed under the terms of the MIT license
|
||
|
# vim:ft=dosini:
|
||
|
#
|
||
|
|
||
|
[Unit]
|
||
|
Description=Terraria Server %i
|
||
|
After=network.target
|
||
|
|
||
|
[Service]
|
||
|
User=terraria
|
||
|
Group=terraria
|
||
|
WorkingDirectory={{ terraria_home }}/%i
|
||
|
EnvironmentFile={{ terraria_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=/bin/sh -c '/usr/bin/screen -DmS %i /usr/bin/java -Xms${JRE_XMS} -Xmx${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 Server is going down: Service was stopped"\\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'
|
||
|
|
||
|
Restart=always
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|