34 lines
758 B
SYSTEMD
34 lines
758 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=ter-admin
|
||
|
WorkingDirectory={{ terraria_root }}/%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 ter-%i ./TerrariaServer.bin.x86_64'
|
||
|
|
||
|
ExecStop=/usr/bin/screen -p 0 -S ter-%i -X eval 'stuff "say Server is going down: Service was stopped"\\015'
|
||
|
ExecStop=/usr/bin/screen -p 0 -S ter-%i -X eval 'stuff "exit"\\015'
|
||
|
ExecStop=/bin/sleep 5
|
||
|
|
||
|
Restart=always
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|