Delay during StartUp

  • Hi Community,

    I need a starup-delay of about 30s after power-on of my RasPi4, to wait until other components of my entertainment equipment are ready. I´m quite sure, there is a delay-command available in the OS-layer, but I have right now not an idea about the syntax and how/where I have to insert it.

    Thank you for your hints

    Henry

  • Hi elonesna,

    thank you for your suggestion. Yes, it could be, that some other tasks are running into a timeout. But if the delay is on the beginning of the startup, it should not disturb other stuff. I´ll try it.

    My alternative solution is a voltage pull down on the HW-reset pin for this 30s after power-on. But I want to avoid this additional HW effort.

    Greetings

    Henry

  • Fine!!

    But when I want to enter the autostart.sh, I could not find the ".config" folder in "storage". I`m using the "File Manager" in Kodi "Add a source" Could you please explain me StepByStep how to find the autostart.sh and how to edit this file. Would be very nice!

    Greetings

    Henry

  • Use putty (putty.exe) or another SSH client to connect to your RPi 4 ( the SSH service needs to be enabled in Settings / LibreELEC / Services ), username = root, password = libreelec , then use nano editor to create or edit existing autostart.sh file:

    nano /storage/.config/autostart.sh

  • explain me StepByStep

    You need a quick linux course, there are many on the internet, you will have no trouble finding one.

    For the moment, type the following commands from an SSH console connected to LE to create your autostart.sh file:

    Code
    echo "#!/bin/sh" > /storage/.config/autostart.sh
    echo "sleep 30s" >> /storage/.config/autostart.sh
    chmod +x /storage/.config/autostart.sh
    reboot # to test
  • Optional suffix is possible:

    Code
     # sleep --help
    BusyBox v1.31.0 (2020-10-25 23:41:19 UTC) multi-call binary.
    
    Usage: sleep [N]...
    
    Pause for a time equal to the total of the args given, where each arg can
    have an optional suffix of (s)econds, (m)inutes, (h)ours, or (d)ays

    autoexec.sh does not need to be executable, to create or add the delay just do:

    Code
    echo "sleep 30" >> /storage/.config/autostart.sh
  • Code
    echo "sleep 30s" >> /storage/.config/autostart.sh

    ^ this is wrong, it should be "30" not "30s"

    Sorry, I like the simple rules, the scripts naming the shell and as executable files, and the sleep command always with the suffix [s, m, h, d], and always checking that they work because there are too many linux that do not follow the rules.