[linux] Dedicated server init script

Find multiplayer games.
Tools/scripts to run a dedicated server.
yfcz
Inserter
Inserter
Posts: 47
Joined: Mon Jul 04, 2016 7:27 pm
Contact:

Re: [linux] Dedicated server init script

Post by yfcz »

Hello,

thanks for nice tool.

I just wonder. Is STOP command also supposed to save game (if so its missing in command description)? Or is map saved directly by Factorio during shutdown?

I ask coz saving on STOP command doesn't work properly on my server. Every time save operation is unfinished save and file is corrupted.

Is there any timeout for save operation?
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: [linux] Dedicated server init script

Post by Bisa »

feds wrote:i'm new.
- learning by doing, nice that you got it working, good luck with your server! :D
Hosting a factorio server? Take a look at this || init script ||.
tacgnol
Inserter
Inserter
Posts: 36
Joined: Sun May 29, 2016 3:51 am
Contact:

Re: [linux] Dedicated server init script

Post by tacgnol »

Would it be possible to add a function in the auto complete shell to get the current factorio server version ? like 'factorio --version' something like that ... would be great :)
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: [linux] Dedicated server init script

Post by Bisa »

tacgnol wrote:Would it be possible to add a function in the auto complete shell to get the current factorio server version ? like 'factorio --version' something like that ... would be great :)
added "version" with the latest commit https://github.com/Bisa/factorio-init/c ... e841cc4371 (checkout the master branch, I did not bother to add a new release yet)
Hosting a factorio server? Take a look at this || init script ||.
tacgnol
Inserter
Inserter
Posts: 36
Joined: Sun May 29, 2016 3:51 am
Contact:

Re: [linux] Dedicated server init script

Post by tacgnol »

$ sudo factorio version
0.14.5


sweet, thanks ! that was quick !
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: [linux] Dedicated server init script

Post by Bisa »

tacgnol wrote:sweet, thanks ! that was quick !
hehe, yea, no problem :D check the commit - I already had the code for getting the version, all I needed was adding the command for it ;p
Hosting a factorio server? Take a look at this || init script ||.
xenotypex
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Jul 17, 2016 9:39 pm
Contact:

Re: [linux] Dedicated server init script

Post by xenotypex »

Script fails to start for 14.12 due to the removal of the autosave interval and number parameters.
tacgnol
Inserter
Inserter
Posts: 36
Joined: Sun May 29, 2016 3:51 am
Contact:

Re: [linux] Dedicated server init script

Post by tacgnol »

xenotypex wrote:Script fails to start for 14.12 due to the removal of the autosave interval and number parameters.
oh that's why ...

I was getting crazy trying to figure out why it wasn't working.
Zombo
Inserter
Inserter
Posts: 36
Joined: Mon Mar 21, 2016 12:52 pm
Contact:

Re: [linux] Dedicated server init script

Post by Zombo »

I also stumbled upon the changes concerning autosave now being configured through server-settings.
Was installing a new Factorio Server on Debian 8 and couldn't get the init script to work.
Thanks for the hint, I changed the files according to the pull requests.
tacgnol
Inserter
Inserter
Posts: 36
Joined: Sun May 29, 2016 3:51 am
Contact:

Re: [linux] Dedicated server init script

Post by tacgnol »

Zombo wrote:I also stumbled upon the changes concerning autosave now being configured through server-settings.
Was installing a new Factorio Server on Debian 8 and couldn't get the init script to work.
Thanks for the hint, I changed the files according to the pull requests.

I tried working with the pull request, and it still doesn't work...

i think i will have to do a fresh install....
mcgoff360
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sat Dec 20, 2014 1:30 pm
Contact:

Re: [linux] Dedicated server init script

Post by mcgoff360 »

is there any way to make the script auto restart the server after X period of time? I am having desync issues with my server on an ec2 server running with a lot of mods. the only way that it seems to fix the problem is to just issue the "service factorio restart" command every ~12 hours or so. I am not super familiar with linux or ec2 so i am not sure what the best way to get the command to be reissued automatically on a specified timeframe
mcgoff360
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sat Dec 20, 2014 1:30 pm
Contact:

Re: [linux] Dedicated server init script

Post by mcgoff360 »

i think i have it working with crontab, which i just figured out. we will see if it works. side note, i was running out of ram on my ec2 instance and i am not sure if that was causing the desync issues, but we will see if it gets fixed
tacgnol
Inserter
Inserter
Posts: 36
Joined: Sun May 29, 2016 3:51 am
Contact:

Re: [linux] Dedicated server init script

Post by tacgnol »

I have an issue when i am using the updater ... the command will freeze, and i have to do a ctrl-c to exit the process.



sudo service factorio update

Checking for updates...
New version core-linux_headless64 0.14.20.
Wrote /tmp/factorio-update/core-linux_headless64-0.14.19-0.14.20-update.zip, apply with `factorio --apply-update /tmp/factorio-update/core-linux_headless64-0.14.19-0.14.20-update.zip`
2016-11-11 18:41:36 [CHAT] <server>: Updating to new Factorio version, be right back
Stopping Factorio: . . cat: /opt/factorio/bin/x64/../../server.pid: No such file or directory
complete!

then i have to ctrl-c to exit the process
^C



someone have an idea to fix this ?
Zombo
Inserter
Inserter
Posts: 36
Joined: Mon Mar 21, 2016 12:52 pm
Contact:

Re: [linux] Dedicated server init script

Post by Zombo »

Stopping Factorio: . . cat: /opt/factorio/bin/x64/../../server.pid: No such file or directory
While the server is running, does the mentioned pid file exist?
illmaren
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Mon Jun 27, 2016 3:25 pm
Contact:

Re: [linux] Dedicated server init script

Post by illmaren »

Got quite a disturbing bug..

When i write
service factorio help (Services etc. everything added)

i get the following:

Code: Select all

/opt/factorio-init/config: line 2: $'\r': command not found
/opt/factorio-init/config: line 6: $'\r': command not found
/opt/factorio-init/config: line 9: $'\r': command not found
/opt/factorio-init/config: line 14: $'\r': command not found
/opt/factorio-init/config: line 19: $'\r': command not found
/opt/factorio-init/config: line 22: $'\r': command not found
/opt/factorio-init/config: line 27: $'\r': command not found
/opt/factorio-init/config: line 36: $'\r': command not found
/opt/factorio-init/config: line 44: $'\r': command not found
/opt/factorio-init/config: line 54: $'\r': command not found
/bin/x64/factorioctorio binary! /opt/factorio
(if you store your binary some place else, override BINARY='/your/path' in the config)
here he tries to access "/bin/x64/factorioctorio" ? Why does he try that...checked the config and the init script but there is nothing there which could do this...;$

Server is ubuntu 15
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: [linux] Dedicated server init script

Post by Bisa »

illmaren wrote:Got quite a disturbing bug..

When i write
service factorio help (Services etc. everything added)

i get the following:

Code: Select all

/opt/factorio-init/config: line 2: $'\r': command not found
/opt/factorio-init/config: line 6: $'\r': command not found
/opt/factorio-init/config: line 9: $'\r': command not found
/opt/factorio-init/config: line 14: $'\r': command not found
/opt/factorio-init/config: line 19: $'\r': command not found
/opt/factorio-init/config: line 22: $'\r': command not found
/opt/factorio-init/config: line 27: $'\r': command not found
/opt/factorio-init/config: line 36: $'\r': command not found
/opt/factorio-init/config: line 44: $'\r': command not found
/opt/factorio-init/config: line 54: $'\r': command not found
/bin/x64/factorioctorio binary! /opt/factorio
(if you store your binary some place else, override BINARY='/your/path' in the config)
here he tries to access "/bin/x64/factorioctorio" ? Why does he try that...checked the config and the init script but there is nothing there which could do this...;$

Server is ubuntu 15

Hi, not sure if you resolved this already (I'm not visiting these forums much lately - please use the github issue tracker if you run into this issue still, have you tried a fresh install of the script?)
Hosting a factorio server? Take a look at this || init script ||.
User avatar
Hovel
Inserter
Inserter
Posts: 21
Joined: Mon Aug 29, 2016 7:32 pm
Contact:

Re: [linux] Dedicated server init script

Post by Hovel »

Bisa,

Please help me out. I'm running a ubuntu server at home and I'm trying to setup a headless server. I'm still new to linux, but I know how to run a headless server. But I read everywhere I should use your init script in combination with the updater from narc0tiq. I can see why an updater would help me, because I manually have to unpack new versions now. But I don't fully understand what your init script helps me with. It will start my factorio server on boot. But is seems to run as a service? how do i manage my server then?

Currently I'm stuck, I can run the script, but it tells me the following:

Code: Select all

thomas@tfdserver:/opt/factorio/factorio-init$ sudo systemctl daemon-reload
thomas@tfdserver:/opt/factorio/factorio-init$ sudo systemctl start factorio
thomas@tfdserver:/opt/factorio/factorio-init$ sudo systemctl status -l factorio
● factorio.service - Factorio Server
   Loaded: loaded (/etc/systemd/system/factorio.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since di 2017-02-28 21:56:30 CET; 7s ago
  Process: 28606 ExecStop=/opt/factorio/factorio-init/factorio stop (code=exited, status=0/SUCCESS)
  Process: 28577 ExecStart=/opt/factorio/factorio-init/factorio start (code=exited, status=0/SUCCESS)
 Main PID: 28597 (code=exited, status=1/FAILURE)

feb 28 21:56:30 tfdserver systemd[1]: factorio.service: Unit entered failed state.
feb 28 21:56:30 tfdserver systemd[1]: factorio.service: Failed with result 'exit-code'.
thomas@tfdserver:/opt/factorio/factorio-init$ sudo systemctl enable factorio
Created symlink from /etc/systemd/system/multi-user.target.wants/factorio.service to /etc/systemd/system/factorio.service.
thomas@tfdserver:/opt/factorio/factorio-init$ sudo systemctl status -l factorio
● factorio.service - Factorio Server
   Loaded: loaded (/etc/systemd/system/factorio.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since di 2017-02-28 21:57:52 CET; 11s ago
 Main PID: 28795 (code=exited, status=1/FAILURE)
   CGroup: /system.slice/factorio.service

feb 28 21:57:52 tfdserver systemd[1]: factorio.service: Unit entered failed state.
feb 28 21:57:52 tfdserver systemd[1]: factorio.service: Failed with result 'exit-code'.
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: [linux] Dedicated server init script

Post by Bisa »

Hovel wrote:Bisa,

Please help me out. I'm running a ubuntu server at home and I'm trying to setup a headless server. I'm still new to linux, but I know how to run a headless server. But I read everywhere I should use your init script in combination with the updater from narc0tiq. I can see why an updater would help me, because I manually have to unpack new versions now. But I don't fully understand what your init script helps me with. It will start my factorio server on boot. But is seems to run as a service? how do i manage my server then?

Currently I'm stuck, I can run the script, but it tells me the following:
Hi, (sorry for not responding sooner) - it would be helpful for others that debug your problem if you gave us the output of your factorio-current.log (you might even be able to find the problem yourself in it) if I may suggest you could always upload the log to pastebin or attach it here.
Hosting a factorio server? Take a look at this || init script ||.
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: [linux] Dedicated server init script

Post by Bisa »

Shameless bump as version 2.5.0 now includes the ability to download the latest headless server from Wube to effortlessly install factorio on your linux server.
Hosting a factorio server? Take a look at this || init script ||.
User avatar
Blaster
Inserter
Inserter
Posts: 41
Joined: Sun Mar 27, 2016 9:16 pm
Contact:

Re: [linux] Dedicated server init script

Post by Blaster »

What's the deal with the ../../ in the path configs? Isthere a reason this is there?
Post Reply

Return to “Multiplayer / Dedicated Server”