autostart.sh and shutdown.sh not working

  • EDIT I found a workaround:

    I couldn' get it working, so I made a node-red flow on my server that creates a HTTP api, and converts the http data to MQTT


    And put a wget in my startup and shutdown script:

    wget -T 2 http://192.168.0.209:1880/endpoint/plexBox/state?state=OFF





    Hello,


    I followed the guide for creating autostart and shutdown commands (This guide). But my commands dont run

    I autostart.sh I have the following code:

    Code
    (
     sleep 50
     docker run -it --rm eclipse-mosquitto mosquitto_pub -h 192.168.0.100 -t plexBox/state -m "ON"
    )&

    And in the shutdown.sh:


    I have docker installed through libreelec. And when I run these commands manually, they work.


    Anyone a suggestion?

    Edited once, last by thebakker: Workaround found ().

  • check the output of

    Code
    systemctl status kodi-autostart.service


    You might need to wait until you have a network connection and docker is started

  • At first, I would remove brackets and & sign from autostart.sh.

    I have no experience with docker but I suppose it's enough to run the docker run command one time to start it so & sign does not make sense, especially when there's the sleep command in brackets as well.


    Edit - irrelevant as explained below...

    Edited once, last by ghtester ().

  • At first, I would remove brackets and & sign from autostart.sh.

    I have no experience with docker but I suppose it's enough to run the docker run command one time to start it so & sign does not make sense, especially when there's the sleep command in brackets as well.

    This is typically done so the calling command can be queued into the background and doesn't block the startup of LibreELEC. Likely the OP would want to block though based on network access and docker starting

  • I know, maybe I am wrong but I still believe in this case these commands should not be queued.


    Edit - a wrong statement...

    Edited once, last by ghtester ().

  • I know, maybe I am wrong but I still believe in this case these commands should not be queued.

    autostart.sh is run at the very start of usespace boot, so the network is not started, kodi (which runs docker via an add-on) is not started. So running the docker command at that point will *allways* fail, and (backgrounding)& is the correct approach.


    The case statement ^ above was incorrect, not sure if it was copy/paste typo or what but I edited it to be correct.


    As lrusak says, look at systemd logs

  • check the output of

    Code
    systemctl status kodi-autostart.service


    You might need to wait until you have a network connection and docker is started

    Thanks, I got the error

    Code
    Mar 14 09:25:36 LibreELEC sh[724]: the input device is not a TTY


    This was an error from my docker command, I fixed it by removing the "-it" argument


    Is there also a log from the shutdown script?


    Quote from ghtester I know, maybe I am wrong but I still believe in this case these commands should not be queued.

    autostart.sh is run at the very start of usespace boot, so the network is not started, kodi (which runs docker via an add-on) is not started. So running the docker command at that point will *allways* fail, and (backgrounding)& is the correct approach.


    The case statement ^ above was incorrect, not sure if it was copy/paste typo or what but I edited it to be correct.


    As lrusak says, look at systemd logs

    But the shutdown doesn't. I think I have the problem you describe: docker gets closed and after that the shutdown script gets called.

    Any idea where I can see the shutdown log?