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

34 lines
782 B
SYSTEMD
Raw Normal View History

2021-01-09 22:35:20 -06:00
#
# 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
2021-01-09 22:35:20 -06:00
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 ./TerrariaServer.bin.x86_64 -config config'
2021-01-09 22:35:20 -06:00
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 "exit"\\015'
2021-01-09 22:35:20 -06:00
Restart=always
[Install]
WantedBy=multi-user.target