RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Launch script when exit Emulationstation

    Scheduled Pinned Locked Moved Help and Support
    exit retropiebashemulationstatioscript
    17 Posts 4 Posters 5.1k 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.
    • A
      Assomnia
      last edited by Assomnia

      I actually would like to start in console and launch a .sh automatically at startup (couldn't manage that either by the way).
      And then this script allows me to launch kodi, emulationstation or startx by just pressing a button. I'm running the pi in a psp therefore the buttons are connected to the GPIO (works fine).
      The script allowing me to launch the softs works well but I have to launch it manually (for now I have a keyboard attached).
      The aim is to launch the soft via the buttons and once I quit the soft I go back to the shell and the script starts again allowing me to launch something else if I want to.

      I hope I was clear enough :/

      RascasR 1 Reply Last reply Reply Quote 0
      • RascasR
        Rascas @Assomnia
        last edited by Rascas

        @Assomnia Why don't you just select to autostart Emulation Station ? You then have options there in Ports menu to launch either Kodi or Pixel or whatever. Much easier. When you exit one of the programs, it goes back automatically to ES again.

        1 Reply Last reply Reply Quote 0
        • A
          Assomnia
          last edited by

          Don't know man, had quite a few issues here and there and I had the idea to do it this way. I don't have that much of knowledge on linux and the soft. Didn't know that I could start ES at boot.
          I installed everything this way and didn't take the retropie image because I couldn't get the wifi to work in kodi then...
          Was a mess.
          Finally this solution is almost working just for a few things.

          Trying to boot my psp and run the script auto. Exit kodi the script starts. Exit ES the script starts and I'm done. Just can't find the way

          RascasR 1 Reply Last reply Reply Quote 0
          • RascasR
            Rascas @Assomnia
            last edited by

            @Assomnia Man, if you don't have the coding skills, just select the ES autostart option, much easier, it is pretty much what most people do.

            A 1 Reply Last reply Reply Quote 0
            • A
              Assomnia @Rascas
              last edited by

              @Rascas Coding skills are necessary for that ? I mean it's just a question of which file is involved when exit and edit that no ?

              meleuM 1 Reply Last reply Reply Quote 0
              • RascasR
                Rascas
                last edited by Rascas

                There is no file involved in everytime you exit programs (plural). But of course you can create a script to run one program and run anything else after.
                If you just want to run a program/script whatever, and you aren't using one of RetroPie autostart options, you can add it to /etc/rc.local, everything in this file is run at the end of boot proccess, user independent. ~/.bashrc runs programs/scripts/etc when the relative user logs in, everytime.

                1 Reply Last reply Reply Quote 0
                • meleuM
                  meleu @Assomnia
                  last edited by

                  @Assomnia didn't /home/pi/.bashrc work for what you want?

                  • Useful topics
                  • joystick-selection tool
                  • rpie-art tool
                  • achievements I made
                  A 1 Reply Last reply Reply Quote 0
                  • A
                    Assomnia @meleu
                    last edited by BuZz

                    @meleu Nop I tried but didn't work out.

                    I actually changed a bit my script and added a new line. Make the thing working but probably it isn't that "clean" so to speak :

                    #!/bin/bash
                    clear
                    echo -e "Welcome\x1b[31m Asso'\x1b[0m : $(date)"
                    echo -e "---------------------------------"
                    echo -e "- Press TRIANGLE ▲ - Kodi"
                    echo -e "- Press SQUARE   ■ - EmulationStation"
                    echo -e "- Press CIRCLE   \033[1mO\033[0m - StartX"
                    echo -e
                    echo -e "- Press Any Key - Back to shell"
                    echo -e "---------------------------------"
                    echo -e
                    
                    read -s -N 1 answer
                    
                    if [ "$answer" == $'\e' ]; then
                        echo "Kodi is Starting !"
                        kodi
                    
                    bash /home/pi/loading.sh
                    
                    elif [ "$answer" = $'a' ]; then
                        echo "EmulationStation is Starting"
                        emulationstation
                    
                    bash /home/pi/loading.sh
                    
                    elif [ "$answer" == $'\x7f' ]; then
                        echo "StartX is Starting"
                        startx
                    
                    else
                        clear
                        echo "Back to Shell !"
                        exit
                    
                    fi
                    
                    BuZzB 1 Reply Last reply Reply Quote 0
                    • BuZzB
                      BuZz administrators @Assomnia
                      last edited by BuZz

                      @Assomnia Please use a code block for code snippets or data will be lost (as characters will be interpreted as styling)

                      http://commonmark.org/help/

                      I amended your post.

                      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

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        Assomnia @BuZz
                        last edited by

                        @BuZz Sorry man, first time here, I will be carefull next time
                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • 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.