Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    Custom Script not running at startup despite following guidance...

    Recalbox General
    script running startup despite following
    3
    27
    10632
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Substring
      Substring last edited by

      One more suggestion : runbash -x /etc/ini.d/S99custom and paste here the output if you can't read it. I'm pretty sure it won't work because of fat32

      Former dev - Please reply with @substring so that i am notified when you answer me
      Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

      1 Reply Last reply Reply Quote 0
      • stigzler
        stigzler last edited by

        @Substring:

        # bash -x /etc/init.d/S99custom
        + test -e /recalbox/share/system/custom.sh
        + /recalbox/share/system/custom.sh
        /etc/init.d/S99custom: /recalbox/share/system/custom.sh: /usr/bin/bash: bad interpreter: No such file or directory
        

        Does my USB3 drive need to be a different format? If so - what and how?
        thanks for both of your ongoing help

        1 Reply Last reply Reply Quote 0
        • stigzler
          stigzler last edited by

          @Substring
          Whoops! Spotted the silly error. Replaced

          #!/usr/bin/bash
          

          with

          #!/bin/bash
          

          "bash -x /etc/ini.d/S99custom" now run the script fine manually. However, still doesn't start at startup!!

          I't doing my head in this issue!

          Substring 1 Reply Last reply Reply Quote 0
          • Substring
            Substring @stigzler last edited by

            @stigzler can you add sime debugging echo to your custom.sh ? And paste your custom.sh script here ?

            Former dev - Please reply with @substring so that i am notified when you answer me
            Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

            1 Reply Last reply Reply Quote 0
            • stigzler
              stigzler last edited by

              @Substring + @lackyluuk
              OK. To try and bottom this, I did a totally clean re-install and still not working. Here's my steps:

              • Formatted USB3 drive to FAT32 @ 4096 Cluster size (irrelevant as tested on SD card boot only)
              • Formatted the 32Gb Samsung SD card with SDCard Formatter
              • Installed fresh installation of recalbox + updated to 4.0.2 (higher updates still unavailable)
              • wrote a new custom.sh script in nano + placed in share\system
              • placed the script fanControl.py in the same directory. CHMod'd them both
              • Tested custom.sh via putty - works fine, displays "Launching Fan Control"
              • Tested fanControl.py individually via putty. Work as it should.
              • Restarted Recalbox. Neither script booted 😞

              Hmmm. This is soo frustrating! I thouhgt I'd hit gold with recalbox, as had tried other images to date, but this one stood head and shoulder above the rest. Until I hit this issue that is! And I need an image that can accommodate custom scripts.

              Below, my two scripts:

              Custom.sh:

              #!/bin/bash
              echo "Launching FanControl"
              python fanControl.py
              

              fanControl.py:

              here

              (I had to include this as a link as the pasted code caused this forum system to mark my post as Spam! Hopefully pastebin should be OK for you guys trusting links)

              That's as much 'out of the box' as I can make.. Any ideas?

              Substring 1 Reply Last reply Reply Quote 0
              • lackyluuk
                lackyluuk Translator last edited by

                @stigzler I really don't know what's wrong.
                But if you like you can try exactly what I did in the Wiki Article to have both scripts as .py scripts and use what I wrote in the S32StartFanControl as a subprocess

                Just for trying 🙂

                NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

                stigzler 1 Reply Last reply Reply Quote 0
                • Substring
                  Substring @stigzler last edited by

                  @stigzler You'd better tweak your custom.sh like :

                  #!/bin/bash
                  recallog "Launching FanControl"
                  /usr/bin/python fanControl.py
                  

                  This way you'll find "Launching FanControl" in ~/logs/recalbox.log. If you do get the output, then it's a problem with python. Notice I added the full path to python, as I don't know how the $PATH looks like at that moment.

                  Former dev - Please reply with @substring so that i am notified when you answer me
                  Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                  1 Reply Last reply Reply Quote 0
                  • stigzler
                    stigzler @lackyluuk last edited by

                    @lackyluuk - thanks but, as above, tried that already. No joy 😞

                    1 Reply Last reply Reply Quote 0
                    • stigzler
                      stigzler last edited by stigzler

                      @Substring.
                      Finally getting somewhere! Did as you directed, and the log reads:

                      [       16.71] : Starting S92switch
                      [       16.73] : script /recalbox/scripts/powerswitch.sh [ STARTED ]
                      [       17.05] : Starting S94manager
                      Will not start pm2 : system.api.enabled is set to 0
                      [       17.32] : Launching FanControl
                      

                      And that's the end of the log at startup. The fan doesn't run, but it does if I run the py script from shell.

                      Also tried:

                      /usr/bin/python fanControl.py
                      

                      from shell - script booted fine.

                      also added logging after the python call in the bash script. This also logged, indicating the python call didn't crash the bash script?

                      [       17.07] : Launching FanControl
                      [       17.17] : fanControl call made.
                      

                      So - it's looking like python is the culprit? What's next?

                      Substring 1 Reply Last reply Reply Quote 0
                      • Substring
                        Substring @stigzler last edited by Substring

                        @stigzler You must understand that a init script doesn't have tne same environment as a logged in user. That's why I suggested you put the full path to python in the custom.sh. I do mean it

                        Go on the IRC channel, there is a link in the topbar. Then call me with @substring, and be patient (I'm on CEST timezone)

                        Former dev - Please reply with @substring so that i am notified when you answer me
                        Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                        1 Reply Last reply Reply Quote 0
                        • Substring
                          Substring last edited by

                          It was 1am when you tried to poke me lol

                          Former dev - Please reply with @substring so that i am notified when you answer me
                          Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                          1 Reply Last reply Reply Quote 0
                          • stigzler
                            stigzler last edited by

                            @substring - apologies on there now..

                            1 Reply Last reply Reply Quote 0
                            • Substring
                              Substring last edited by

                              So, there were 2 culprits :

                              • had to start the .py as multiprocess
                              • the script tried to open an unexisting logfile : forced the path

                              Former dev - Please reply with @substring so that i am notified when you answer me
                              Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                              1 Reply Last reply Reply Quote 1
                              • stigzler
                                stigzler last edited by

                                Many thanks @SubString. Actually remoted into my machine and sorted it all for me. What a star!

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post

                                Want to support us ?

                                73
                                Online

                                99.6k
                                Users

                                28.1k
                                Topics

                                187.1k
                                Posts

                                Copyright © 2021 recalbox.com