RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Need for start up and shutdown user scripts?

    Scheduled Pinned Locked Moved Ideas and Development
    runcommand
    6 Posts 4 Posters 543 Views
    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.
    • RincewindR
      Rincewind
      last edited by Rincewind

      There exists the need for a Retropie native method to run user scripts on boot and shutdown.

      For example, I wrote some scripts to switch my button lights on and off acording to the game being played (rpi-arcade-lights). I can use the runcommand-onstart.sh and runcommand-onend.sh script to change the lights before the game launches and after the game ends. There are two other hooks I need: RetroPie start up and shut down. Without these my lights stay on after the system shuts down and don't switch on after the machine boots. There are ways to achieve what I want, but they are imperfect.

      So I have seen others advise using the /opt/retropie/configs/all/autostart.sh script, but this seems to get rewritten under certain conditions, such as running retropie_setup.sh. This is not ideal.

      It would be really useful if there were a runcommand-onboot.sh and runcommand-onshutdown.sh that were only for user scripts and gauranteed not to be rewritten by RetroPie.

      S 1 Reply Last reply Reply Quote 0
      • S
        sleve_mcdichael @Rincewind
        last edited by sleve_mcdichael

        @rincewind said in Need for start up and shutdown user scripts?:

        It would be really useful if there were a runcommand-onboot.sh and runcommand-onshutdown.sh that were only for user scripts and gauranteed not to be rewritten by RetroPie.

        Runcommand isn't running at those times, but EmulationStation usually is: https://retropie.org.uk/docs/EmulationStation/#scripting

        RincewindR 1 Reply Last reply Reply Quote 0
        • RincewindR
          Rincewind
          last edited by Rincewind

          @sleve_mcdichael Thanks for that. I didn't know that that existed.

          It looks like there is no script for boot up offered by emulation station.

          Also more fundametally, would it not make sense to have a frontend agnostic hooks? This may be unneccesary abstraction, but what if the user changes to Attract-Mode, then they would have to write new scripts. RetroPie already offers duplicate hooks i.e. onstart and onend.

          LolonoisL 1 Reply Last reply Reply Quote 0
          • RincewindR
            Rincewind @sleve_mcdichael
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • BuZzB
              BuZz administrators
              last edited by BuZz

              autostart.sh doesn't get overwritten by running retropie_setup.

              To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

              1 Reply Last reply Reply Quote 0
              • LolonoisL
                Lolonois @Rincewind
                last edited by

                @rincewind said in Need for start up and shutdown user scripts?:

                Also more fundametally, would it not make sense to have a frontend agnostic hooks?

                No need to reinvent the wheel: Systemd (service type oneshot) is most likely your friend.

                https://wiki.archlinux.org/title/Systemd#Service_types

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

                Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.