Skip to content

Server Autostart on Unraid #409

Open

Description

@Tronnic

Hello everyone, I am unable to setup Server Autostart within my unraid docker.

image

I set the FSM_AUTOSTART variable to true but the server remains offline.

My unraid server does a backup of all containers at night, which results in the factorio server being offline. Is there any possible fix for this?

Is there any other way to fix the autostart? Where would the conf.json be?

Any help would be greatly appreciated!

Best regards,
Frank.

Activity

  1. matmat07 commented on Oct 21, 2024

    @matmat07

    I can confirm the same behaviour. To add to that and confirm the value was passed correctly, here's the output of a command for the container:

    printenv

    HOSTNAME=6ca9cbef4a20
    HOME=/root
    HOST_OS=Unraid
    FSM_AUTOSTART=true
    TERM=xterm
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    FACTORIO_VERSION=latest
    HOST_HOSTNAME=Tower
    HOST_CONTAINERNAME=FactorioServerManager
    PWD=/opt
    RCON_PASS=
    TZ=America/New_York

  2. Mattie112 commented on Oct 22, 2024

    @Mattie112
    Contributor

    see: #301 for more

  3. Tronnic commented on Oct 22, 2024

    @Tronnic
    Author

    Is it in any way possible to start the factorio server within the container trough command line? Maybe a workaround would be to create a userscript that runs after the backup is complete to start the server "manually".

    Using the Evn.Variables seems to be bugged in fsm/unraid.

  4. Mattie112 commented on Oct 22, 2024

    @Mattie112
    Contributor

    @Tronnic see #301 (comment) for a possible work-around

  5. Tronnic commented on Oct 22, 2024

    @Tronnic
    Author

    @Mattie112 I have looked into the possible fix with the entrypoint.sh, unfortunately this doesn't work for me as well.

  6. Leridon commented on Oct 22, 2024

    @Leridon

    What confuses me about the docker installation is that entrypoint.sh does not appear to pass any of its CLI arguments to the actual fsm process. So when starting the container using docker run ofsm --autostart true (or any other parameter), all parameters are dropped. Am I missing something or is this an oversight and the last command of entrypoint.sh should include an "$@" at the end?

  7. Mattie112 commented on Oct 22, 2024

    @Mattie112
    Contributor

    That could very well be the case but I won't have time to dive into it before the weekend. If you can test it out and report back (or create a PR) that would be great! If not I will try it in the weekend.

  8. Leridon commented on Oct 22, 2024

    @Leridon

    @Mattie112 I tested exactly that (after taking some time to get the docker build going locally) and it appears to work fine. With the argument passing added it now reacts to --autostart true as expected when running it, as well as all other cli parameters.

    Here's the command I tested this with: docker run -p 80:80 -v ./factorio-data/saves:/opt/factorio/saves -v ./factorio-data/mods:/opt/factorio/mods -v ./factorio-data/config:/opt/factorio/config -p 34197:34197/udp localofsm:latest --autostart true

    Want me to create a PR for this miniscule change? I know this does not fix the original problem with Environment variables, but still seems relevant because as it stands right now, CLI parameters to fsm are ignored in docker.

  9. OnlyPlean commented on Oct 23, 2024

    @OnlyPlean

    @Tronnic I've gotten the autostart feature to work on Factorio Server Manger.

    I am deploying the container via Unraid and followed these steps:

    1. Turn on the container
    2. Open the console for the container
    3. Install nano (or whatever text editor you like) as one is not installed by default in the container
      apt-get update && apt-get install nano
    4. Open the entrypoint.sh with your text editor
      nano entrypoint.sh
    5. Edit the final line to the following:
      cd /opt/fsm && ./factorio-server-manager --conf /opt/fsm-data/conf.json --dir /opt/factorio --port 80 --autostart true "$@"

    After adding the --autostart true with the "$@" to the end of the line I saved and quit the editor. Restarting the container showed the server start automatically!

    Thank you to @Leridon for figuring this out!

    Hope this helps!

  10. sucr4m commented on Feb 3, 2025

    @sucr4m

    @Tronnic I've gotten the autostart feature to work on Factorio Server Manger.

    I am deploying the container via Unraid and followed these steps:

    1. Turn on the container
    
    2. Open the console for the container
    

    correct me if im wrong but doesnt this get lost when you actually restart the unraid server or update the docker container?

  11. EthanetXYZ commented on Jul 30, 2025

    @EthanetXYZ

    @Tronnic I've gotten the autostart feature to work on Factorio Server Manger.
    I am deploying the container via Unraid and followed these steps:

    1. Turn on the container
    
    2. Open the console for the container
    

    correct me if im wrong but doesnt this get lost when you actually restart the unraid server or update the docker container?

    Just came here to say that this worked for me and seems to persist through restarts. I'm too smooth brain to understand why, but it does.

  12. EthanetXYZ commented on Jul 30, 2025

    @EthanetXYZ

    @Tronnic I've gotten the autostart feature to work on Factorio Server Manger.
    I am deploying the container via Unraid and followed these steps:

    1. Turn on the container
    
    2. Open the console for the container
    

    correct me if im wrong but doesnt this get lost when you actually restart the unraid server or update the docker container?

    Just came here to say that this worked for me and seems to persist through restarts. I'm too smooth brain to understand why, but it does.

    It does not survive an image update... :( back to square one for me

  13. EthanetXYZ commented on Jul 30, 2025

    @EthanetXYZ

    Okay, switching to the develop branch allows the environmental variable to work

    Set FSM_AUTOSTART to true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions