Skip to content

StuartJSquires/factorio-init

 
 

Repository files navigation

Factorio Init Script

A simple factorio init script for linux

Debugging

If you find yourself wondering why stuff is not working the way you expect:

  • Check the logs, I suggest you tail -f /opt/factorio/factorio-current.log in a separate session
  • Enable debugging in the config and/or:
  • Try running the same commands as the factorio user (/opt/factorio-init/factorio invocation will tell you what the factorio user tries to run at start)
$ /opt/factorio-init invocation
#  Run this as the factorio user, example:
$ sudo -u factorio 'whatever invocation gave you'
# You should see some output in your terminal here, hopefully giving
# you a hint of what is going wrong

Install

  • Create a directory where you want to store this script along with configuration. (either copy-paste the files or clone from github):
$ cd '/opt'
$ git clone https://github.com/Bisa/factorio-init.git
  • Rename config.example to config and modify the values within according to your setup.

Autocompletion

  • Copy/Symlink or source the bash_autocompletion file
$ ln -s /opt/factorio-init/bash_autocomplete /etc/bash_completion.d/factorio
# OR:
$ echo "source /opt/factorio-init/bash_autocomplete" >> ~/.bashrc
# restart your shell to verify that it worked

Systemd

  • Copy the example service, adjust & reload
$ cp /opt/factorio-init/factorio.service.example /etc/systemd/system/factorio.service
# Edit the service file to suit your environment then reload systemd
$ systemctl daemon-reload
  • Verify that the server starts
$ systemctl start factorio
$ systemctl status -l factorio
# Remember to enable the service at startup if you want that:
$ systemctl enable factorio

SysvInit

  • Symlink the init script:
$ ln -s /opt/factorio-init/factorio /etc/init.d/factorio
# Make the script executable:
$ chmod +x /opt/factorio-init/factorio
# Try it out:
$ service factorio help
# Do not forget to enable the service at boot if you want that.

Thank You

  • To all who find this script useful in one way or the other
  • A big thank you to Wube for making Factorio
  • A special thanks to NoPantsMcDance, Oxyd, HanziQ, TheFactorioCube and all other frequent users of the #factorio channel @ esper.net
  • Thank you to Salzig for pointing me in the right direction when it comes to input redirection
  • At last, but not least; Thank you to all contributors and users posting issues in my github project or on the factorio forums

You are all a great source of motivation, thank you.

License

This code is realeased with the MIT license, see the LICENSE file.

About

Factorio init script

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%