Re: [linux] Dedicated server init script
Posted: Fri Jul 15, 2016 3:07 pm
No problem. I'm also a developer and ran some largeish open source projects for many years. I know the importance of good questions
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)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?
found it: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
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 respectivelyPhantom329 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.
Code: Select all
ln -s /opt/factorio-init/factorio /usr/local/bin/factorio
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
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'.
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)
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.
Looks like you are unable to start factorio? what happens if you run the invocation command manually?feds wrote: 0.428 Error Util.cpp:57: No such node (description)[/code]
i'm not sure this is what you're asking for but maybeBisa wrote:Looks like you are unable to start factorio? what happens if you run the invocation command manually?feds wrote: 0.428 Error Util.cpp:57: No such node (description)[/code]
i.e whatever "./factorio invocation" outputs
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.
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)
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.feds wrote: 0.422 Error Util.cpp:57: No such node (description)
np, btw - what OS are you running? (also did you try the headless binary?)feds wrote:well thanks for looking and replying anyway