summarylogtreecommitdiffstats
path: root/terraria-server@.service
blob: efe71d324c2746a387f5196fc1c753cb4961c460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[Unit]
Description=Terraria Server %i
After=network.target

[Service]
User=terraria
Type=simple
# Screen is used, because the terraria server binary crashes if called on its own.
ExecStart=/usr/bin/screen -DmS terraria-server-%i /usr/bin/terraria-server -config /opt/terraria-server/%i.conf
# Send a warning message to all players and the exit command through screen to let the program terminate itself gracefully
ExecStop=/usr/bin/screen -S terraria-server-%i -X stuff "say Server shutting down. Saving world.\015"
ExecStop=/usr/bin/screen -S terraria-server-%i -X stuff "exit\015"
# Don't stop process automatically, but still send SIGKILL after a timeout
KillMode=control-group
KillSignal=SIGCONT
SendSIGKILL=yes

[Install]
WantedBy=multi-user.target