Page 1 of 1

[0.16.36] Headless Server Ubuntu, start as service issue

Posted: Sat Apr 28, 2018 10:01 pm
by thatdude333
Hello all,

I've followed this guide to set up Factorio as a headless server on an Ubuntu VPS.

The following systemctl service runs with no issues:

Code: Select all

[Unit]
Description=Factorio Server service
After=network.target

[Service]
User=gamemaster
ExecStart=/home/gamemaster/factorio/bin/x64/factorio --server-settings /home/gamemaster/factorio/data/server-settings.json --start-server-load-latest --console-log /home/gamemaster/Factorio.log
Restart=always

[Install]
WantedBy=multi-user.target
But I'd like to start the server with screen command so that I can SSH in and attach to the current server terminal session. I've tried adding "screen -S Factorio" to the start of the ExecStart line like so:

Code: Select all

ExecStart=screen -S Factorio /home/gamemaster/factorio/bin/x64/factorio --server-settings /home/gamemaster/factorio/data/server-settings.json --start-server-load-latest --console-log /home/gamemaster/Factorio.log
but this ends up giving me an error "Executable path is not absolute" in the systemctl log and fails to start Factorio on boot. Though I can open a terminal session and run the same command "screen -S Factorio /home/gamemaster/factorio/bin/x64/factorio --server-settings /home/gamemaster/factorio/data/server-settings.json --start-server-load-latest --console-log /home/gamemaster/Factorio.log" and it starts up the server and everything is fine.

Does anyone know what the issue is with adding the screen command to ExecStart? Is my syntax messed up?

Re: [0.16.36] Headless Server Ubuntu, start as service issue

Posted: Sun Apr 29, 2018 1:04 am
by betrok
You need absolute path to screen executable. Like /usr/bin/screen.

Btw why will you need terminal? You can check logs in journal and execute commands via rcon.

Re: [0.16.36] Headless Server Ubuntu, start as service issue

Posted: Sun Apr 29, 2018 1:31 am
by Zavian
Normally for long running processes you either start them as a service (especially if they should start automatically every boot), or you use something like screen. I'm not sure trying to use screen under systemd will work.

Re: [0.16.36] Headless Server Ubuntu, start as service issue

Posted: Tue May 01, 2018 6:09 am
by RaumSchnee
As for screen and systemd being used together, it is possible, and not that hard. they do play nice. I use that strategy with my Minecraft server, it allows me to get to the console(you normally cant when its hidden behind sys d) and easily swap between/host multiple minecraft worlds. all you have to do is set the execute path to go to screen first, then hand the screen process the exe path for facotrio(or other game service) I usually manage that by pushing the startup command into the screen after its initialized