7 Days to Die Server on Ubuntu with background service
Sometime back I created a service for this game so I didnt have to manage it in a separate terminal. Saw a lot of tutorials that used this method, thankfully I have know linux well enough to improve this. Important to look over the serverconfig.xml. I've noticed it you have an error in the server config the game just doesn't start but that could have been combined with other bugs I was working out at the time of writing this. In any case need to make sure all things are in order before adding this service solution.
chmod u+x sdaysded.service
sudo systemctl enable sdaysded.service
Step one: Create File
vim /etc/systemd/system/sdaysded.servicechmod u+x sdaysded.service
sudo systemctl enable sdaysded.service
Step Two: Write to File
[Unit]
Description=sdaysded service
After=network.target
StartLimitIntervalSec=0
[Service]
#User=steam
Restart=always
RestartSec=1
#WorkingDirectory=/home/sdaysded
ExecStart=/home/sdaysded/startserver.sh -configfile=/home/sdaysded/serverconfig.xml
[Install]
WantedBy=multi-user.target
Step 3: Test
journalctl -u service-name.service
Errors:
- https://stackoverflow.com/questions/1763156/127-return-code-from
- How-to-debug-a-failed-systemctl-service-code-exited-status-217-use
Next Level:
- https://www.gameserverapp.com/linuxgsm-support/?camp=linuxgsm&grp=sdtdserver
- https://steamcommunity.com/sharedfiles/filedetails/?l=german&id=360404397
- https://superuser.com/questions/1156676/what-causes-systemd-failed-at-step-user-spawning-usr-sbin-opendkim-no-such-p
- https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6