[0.16.36] Headless Server Ubuntu, start as service issue

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
thatdude333
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat Apr 28, 2018 9:17 pm
Contact:

[0.16.36] Headless Server Ubuntu, start as service issue

Post 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?
betrok
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Feb 28, 2018 12:08 pm
Contact:

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

Post 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.
Zavian
Smart Inserter
Smart Inserter
Posts: 1649
Joined: Thu Mar 02, 2017 2:57 am
Contact:

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

Post 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.
RaumSchnee
Inserter
Inserter
Posts: 22
Joined: Sat Apr 22, 2017 5:10 pm
Contact:

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

Post 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
Post Reply

Return to “Technical Help”