Page 4 of 6

Re: [linux] Dedicated server init script

Posted: Fri Jul 15, 2016 3:07 pm
by edalquist
No problem. I'm also a developer and ran some largeish open source projects for many years. I know the importance of good questions :)

Re: [linux] Dedicated server init script

Posted: Sun Jul 17, 2016 8:15 am
by Bisa
IF YOU USED THE DEFAULT CONFIG: Adjust the --allow-commands admins-only option, this was fixed in my last commit to master and will be included in releases past but not inlcuding 2.3.0

Re: [linux] Dedicated server init script

Posted: Wed Jul 20, 2016 1:10 pm
by Zombo
Is your script eligible to run multiple factorio servers parallel on the same server? On different ports of course. Which changes would be needed to achieve this?

Re: [linux] Dedicated server init script

Posted: Wed Jul 20, 2016 9:03 pm
by Bisa
Zombo wrote:Is your script eligible to run multiple factorio servers parallel on the same server? On different ports of course. Which changes would be needed to achieve this?
the simplest solution would be to have multiple copies of my script+its config, else you want to have a look at what the script does and divide it into instances (totally doable but not implemented in the script - feel free to pull request if you develop that)

Re: [linux] Dedicated server init script

Posted: Sun Aug 14, 2016 12:16 am
by mophydeen
Is there a save command?

Just save the map and keep playing.
currently using 'save-game name' but this requires a restart

ty

Re: [linux] Dedicated server init script

Posted: Sun Aug 14, 2016 12:22 am
by mophydeen
mophydeen wrote:Is there a save command?

Just save the map and keep playing.
currently using 'save-game name' but this requires a restart

ty
found it:

./factorio cmd /save

Re: [linux] Dedicated server init script

Posted: Sun Aug 21, 2016 11:52 pm
by Phantom329
I'm trying to setup my server but I try to run it and it says it cant find factorio.service but I put it in /factorio-init. How do I fix this? Thanks.

Re: [linux] Dedicated server init script

Posted: Mon Aug 22, 2016 6:35 am
by Bisa
Phantom329 wrote:I'm trying to setup my server but I try to run it and it says it cant find factorio.service but I put it in /factorio-init. How do I fix this? Thanks.
Hi, by your question it's not apparent if you are running sysv or systemd - have a look at https://github.com/Bisa/factorio-init#sysvinit and https://github.com/Bisa/factorio-init#systemd respectively
If you still have issues, try running the script directly & also check out the debugging options outlined on the github readme page.

Re: [linux] Dedicated server init script

Posted: Thu Sep 01, 2016 9:41 pm
by tacgnol
Hello Bisa, I just updated the init script to use the autocompletion... but i'm not sure how to use it ? what king of function does it do ?

Re: [linux] Dedicated server init script

Posted: Thu Sep 01, 2016 9:43 pm
by Bisa
presenting v2.3.1 - now with auto completion for bash

also @tacgnol try sourcing the auto complete script and type "factorio [tab][tab]" it will help you finish the arguments for the factorio script

Re: [linux] Dedicated server init script

Posted: Thu Sep 01, 2016 9:54 pm
by tacgnol
It doesn't seems to work.

Heres what I done :

cd /opt/factorio-init
git pull
ln -s /opt/factorio-init/bash_autocomplete /etc/bash_completion.d/factorio

then reboot the server.

when i try to auto complete, it doesn't recognise 'factorio' as a valid command.



$ fa (tab)
factor faked-sysv fakeroot fakeroot-tcp false
faillog faked-tcp fakeroot-sysv fallocate fatlabel

Re: [linux] Dedicated server init script

Posted: Thu Sep 01, 2016 9:58 pm
by Bisa
ah, good catch! you need to ensure your shell knows about the factorio command (I suggest adding it to your /usr/local/bin folder as such:

Code: Select all

ln -s /opt/factorio-init/factorio /usr/local/bin/factorio
(btw restarting the server wont be needed when adding stuff to the auto complete folder or bashrc, simply log out and in again ;))

Re: [linux] Dedicated server init script

Posted: Thu Sep 01, 2016 10:19 pm
by tacgnol
now it's working with that last command :

Code: Select all

$ factorio --help
DEBUG: Determining WRITE_DIR based on /opt/factorio/config/config.ini, IF you edited write-data from the default, this probably fails
DEBUG: write path: /opt/factorio/bin/x64/../..
Usage: /usr/local/bin/factorio COMMAND

Available commands:
   start                 Starts the server
   stop                  Stops the server
   restart               Restarts the server
   status                Displays server status
   players-online        Shows online players
   players               Shows all players
   cmd [command/message] Open interactive commandline or send a single command to the server
   chatlog [--tail|-t]   Print the current chatlog, optionally tail the log to follow in real time
   new-game name         Stops the server and creates a new game with the specified name
   save-game name        Stops the server and saves game to specified save
   load-save name        Stops the server and loads the specified save
   install tarball       Installs the server with specified tarball
   update [--dry-run]    Updates the server
   invocation            Outputs the invocation for debugging purpose
   listcommands          List all init-commands
   listsaves             List all saves
   help                  Shows this help message

sweet !

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 6:16 pm
by feds
i'm having trouble getting this to run on my google cloud server

trying to run stable 0.13.20, i've copied everything over and everything is extracted to /opt. i didn't modify the service example at all, only the server settings and config file

when i try to verify the server has started properly, it returns the following:

Code: Select all

$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 Sun 2016-09-04 16:32:50 UTC; 6s ago
Process: 6683 ExecStop=/opt/factorio-init/factorio stop (code=exited, status=0/SUCCESS)
Process: 6657 ExecStart=/opt/factorio-init/factorio start (code=exited, status=0/SUCCESS)
Main PID: 6678 (code=exited, status=1/FAILURE)

Sep 04 16:32:50 factorio-instance systemd[1]: factorio.service: Unit entered failed state.
Sep 04 16:32:50 factorio-instance systemd[1]: factorio.service: Failed with result 'exit-code'.
i checked my log for factorio-current, and it shows

Code: Select all

   0.053 Running in headless mode
   0.055 Loading mod core 0.0.0 (data.lua)
   0.058 Loading mod base 0.13.20 (data.lua)
   0.133 Checksum for core: 303426634
   0.133 Checksum for mod base: 1460151764
   0.426 Info PlayerData.cpp:47: Local player-data.json unavailable
   0.426 Info PlayerData.cpp:52: Cloud player-data.json unavailable
   0.427 Custom inputs active: 0
   0.427 Factorio initialised
   0.428 Error Util.cpp:57: No such node (description)
here's what i get when i run sudo -u factorio /opt/factorio/bin/x64/factorio --create /opt/factorio/saves/

Code: Select all

0.000 2016-09-04 17:38:57; Factorio 0.13.20 (build 24011, linux64, headless)
0.043 Operating system: Linux (Ubuntu 16.04)
0.043 Program arguments: "/opt/factorio/bin/x64/factorio" "--create" "/opt/factorio/saves/" 
0.043 Read data path: /opt/factorio/data
0.043 Write data path: /opt/factorio
0.043 Binaries path: /opt/factorio/bin
0.050 Running in headless mode
0.052 Loading mod core 0.0.0 (data.lua)
0.056 Loading mod base 0.13.20 (data.lua)
0.132 Checksum for core: 303426634
0.132 Checksum for mod base: 1460151764
0.424 Info PlayerData.cpp:47: Local player-data.json unavailable
0.424 Info PlayerData.cpp:52: Cloud player-data.json unavailable
0.425 Custom inputs active: 0
0.426 Factorio initialised
0.426 Info Main.cpp:547: Creating new map /opt/factorio/saves/
3.505 Info Scenario.cpp:127: Map version 0.13.20-0
3.583 Checksum for script /opt/factorio/temp/currently-playing/control.lua: 900459546
Done.

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 6:20 pm
by Bisa
feds wrote: 0.428 Error Util.cpp:57: No such node (description)[/code]
Looks like you are unable to start factorio? what happens if you run the invocation command manually?
i.e whatever "./factorio invocation" outputs

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 6:23 pm
by feds
Bisa wrote:
feds wrote: 0.428 Error Util.cpp:57: No such node (description)[/code]
Looks like you are unable to start factorio? what happens if you run the invocation command manually?
i.e whatever "./factorio invocation" outputs
i'm not sure this is what you're asking for but maybe

Code: Select all

$ /opt/factorio/bin/x64/factorio --config /opt/factorio/config/config.ini --port 3
4197 --start-server-load-latest --server-settings /opt/factorio/data/server-settings.json --autosave-interval 10
 --autosave-slots 3 --allow-commands admins-only
   0.000  Error Util.cpp:57: Could not move file "factorio-current.log". Another instance of Factorio is probabl
y already running.
edit: oops i think this is what you wanted:

Code: Select all

 sudo -u factorio /opt/factorio/bin/x64/factorio --config /opt/factorio/config/co
nfig.ini --port 34197 --start-server-load-latest --server-settings /opt/factorio/data/server-settings.json --aut
osave-interval 10 --autosave-slots 3 --allow-commands admins-only
   0.000 2016-09-04 18:30:51; Factorio 0.13.20 (build 24011, linux64, headless)
   0.044 Operating system: Linux (Ubuntu 16.04)
   0.044 Program arguments: "/opt/factorio/bin/x64/factorio" "--config" "/opt/factorio/config/config.ini" "--por
t" "34197" "--start-server-load-latest" "--server-settings" "/opt/factorio/data/server-settings.json" "--autosav
e-interval" "10" "--autosave-slots" "3" "--allow-commands" "admins-only" 
   0.044 Read data path: /opt/factorio/data
   0.045 Write data path: /opt/factorio
   0.045 Binaries path: /opt/factorio/bin
   0.052 Running in headless mode
   0.054 Loading mod core 0.0.0 (data.lua)
   0.057 Loading mod base 0.13.20 (data.lua)
   0.132 Checksum for core: 303426634
   0.132 Checksum for mod base: 1460151764
   0.420 Info PlayerData.cpp:47: Local player-data.json unavailable
   0.420 Info PlayerData.cpp:52: Cloud player-data.json unavailable
   0.421 Custom inputs active: 0
   0.422 Factorio initialised
   0.422 Error Util.cpp:57: No such node (description)

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 6:36 pm
by Bisa
Aye, there it is again:
feds wrote: 0.422 Error Util.cpp:57: No such node (description)
I'm afraid I have no idea what that error means (It's an error from factorio itself, not my init script), you need to figure that one out before you can use my script I'm afraid.
Have you tried the 0.14.x releases? (perhaps it's fixed in a later version already)

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 6:45 pm
by feds
well thanks for looking and replying anyway :(

yes i tried 14.3 first and thought it might be an error with experimental builds

it's probably something i misconfigured on the google instance, i just set it up to try and run a server for factorio, so i'm still learning

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 7:51 pm
by Bisa
feds wrote:well thanks for looking and replying anyway :(
np, btw - what OS are you running? (also did you try the headless binary?)

Re: [linux] Dedicated server init script

Posted: Sun Sep 04, 2016 10:00 pm
by feds
it's ubuntu 16.04 LTS
i figured it out and it's so dumb :D

when i edited the server settings where it says "name", "description", "tags", i edited those instead of the text to the right of them

i'm new.

:roll: