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

    Power On/Off Option in Main Menu

    Scheduled Pinned Locked Moved Help and Support
    power optionmain menusystem menu
    37 Posts 9 Posters 18.4k 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.
    • chicueloC
      chicuelo @cyperghost
      last edited by chicuelo

      @cyperghost
      Lovely, I read about that script but I dont know how to implement it on this script.
      Im running it but I have this two scripts only:

      Shutdown
      #!/bin/bash
      sudo shutdown -h now

      Reboot
      #!/bin/bash
      sudo shutdown -r now

      cyperghostC 1 Reply Last reply Reply Quote 0
      • cyperghostC
        cyperghost @chicuelo
        last edited by cyperghost

        @chicuelo
        In this case I would place the multi_switch.sh in a directory like /home/pi/RetroPie/scripts

        So type mkdir /home/pi/RetroPie/scripts
        enter that directory with cd /home/pi/RetroPie/scriptsand then wget https://raw.githubusercontent.com/crcerror/ES-generic-shutdown/master/multi_switch.sh && chmod +x multi_switch.sh to download it.

        Now the shutdown/reboot calls would be just

        #!/bin/bash
        # **SHUTDOWN**
        echo "Shutdown ...."
        sleep 1
        /home/pi/RetroPie/scripts/multi_switch.sh --es-poweroff &
        

        and

        #!/bin/bash
        # **RESTART ES**
        echo "Restarting ES ..."
        sleep 1
        /home/pi/RetroPie/scripts/multi_switch.sh --es-restart &
        

        I would prefer --es-restart instead of --es-reboot

        Ask if you have further questions about this ;)

        EDIT
        The guide is a bit old. I would modify es_system rather like this. Then this will work on FAT32 systems, too.
        I just added a bash command to the ROM executive ;)

          <system>
            <name>power</name>
            <fullname>Power Menu</fullname>
            <path>/home/pi/RetroPie/roms/power</path>
            <extension>.sh .SH</extension>
            <command>bash %ROM%</command>
            <platform>linux</platform>
            <theme>power</theme>
          </system>
        
        chicueloC 2 Replies Last reply Reply Quote 1
        • chicueloC
          chicuelo @cyperghost
          last edited by

          @cyperghost

          Great! I will give it a try, many thanks!

          1 Reply Last reply Reply Quote 0
          • chicueloC
            chicuelo @cyperghost
            last edited by

            @cyperghost
            Unfortunately it does not work, the script worked fine but the favorites won't remain after restar, reboot or power off, I checked any permission issues but there aren't. I went back tho the firs script because I dislike the terminated sentence at the end :(

            cyperghostC 1 Reply Last reply Reply Quote 1
            • cyperghostC
              cyperghost @chicuelo
              last edited by

              @chicuelo Let me try in Monday.
              Terminated means no proper shutdown.
              I think it has something to do that a script is called weithin ES.
              I will test ....

              chicueloC 1 Reply Last reply Reply Quote 1
              • chicueloC
                chicuelo @cyperghost
                last edited by

                @cyperghost
                Thanks! let me know if you find any issue

                cyperghostC 1 Reply Last reply Reply Quote 1
                • cyperghostC
                  cyperghost @chicuelo
                  last edited by cyperghost

                  @chicuelo Yes it was so easy! ;)
                  Just add an &- changed the scripts ... they worked flawless in my testing area ;)
                  I didn't work because of following....

                  You start a bash script within ES (that's the same as an emulator call for ex)
                  Now you start annother script that will shutdown ES. But the first script (started via ES) is still active and waits for the shutdown script to exit ----->> You are bu... terminated!

                  It's just an ironic... because the orginal NESPi+ script works the same way. As long an emulator is active in background there will be never clean shutdowns ;) But with the multi_switch you can do really fine things like prober shutdown with the an extended python script based on the NESPi+ ones

                  chicueloC 1 Reply Last reply Reply Quote 1
                  • chicueloC
                    chicuelo @cyperghost
                    last edited by

                    @cyperghost said in Power On/Off Option in Main Menu:

                    extended python script based on the NESPi+ ones

                    Thanks @cyperghost , where I have to add the &? in the reboot and power scirpt?

                    cyperghostC 1 Reply Last reply Reply Quote 0
                    • cyperghostC
                      cyperghost @chicuelo
                      last edited by cyperghost

                      @chicuelo No... take a look here

                      You have to send the multi_switch to background, then the ES called reboot or shutdown script will finish and my script makes the work ;)

                      chicueloC 1 Reply Last reply Reply Quote 1
                      • chicueloC
                        chicuelo @cyperghost
                        last edited by

                        @cyperghost
                        Worked like a charm! thank you very much!

                        1 Reply Last reply Reply Quote 1
                        • cyperghostC
                          cyperghost
                          last edited by cyperghost

                          @chicuelo This little tool is very usefull. I make always use of it if some emulators are stuck (OpenBOR will not accept new controllers if they are disconnected) so make a SSH session via smartphone and just type multi_switch. --es-closeemu --> problem solved and you are back in ES main mode ;) You can close every emulator with this as long it was initiated by runcommand. Even KODI and PIXEL Desktop can be closed with this ;)

                          And you can add it to any python script if you want ;)

                          chicueloC 1 Reply Last reply Reply Quote 1
                          • chicueloC
                            chicuelo @cyperghost
                            last edited by

                            @cyperghost
                            Lovely! I have some problems with lr-vice and this is very useful!

                            1 Reply Last reply Reply Quote 1
                            • J
                              Jste84 @pana
                              last edited by Jste84

                              @pana said in Power On/Off Option in Main Menu:

                              @battlecat Hey, did you figure it out?

                              I am explaining how to set it up anyway:

                              1. Download the compressed folder from the link provided in the video description

                                and unzip it.

                              2. It contain another folder called "Power Menu" which contain 4 folders ("Gamelist", "Images", "Rom", "Theme") and a file ("es_system.cfg").

                              3. Copy the contents of "Gamelist" to "~/.emulationstation/gamelists" ["~" is equivalent to writing "/home/your_user_name", say "/home/pi"]

                              4. Create a directory called "downloaded_images" inside "~/.emulationstation"

                              5. Copy the contents of "Images" to "~/.emulationstation/downloaded_images"

                              6. Copy the contents of "Rom" to "~/RetroPie/roms"

                              7. Copy the contents of "Theme" to "/etc/emulationstation/themes". Here you will need super user permission.

                              8. Copy the content of es_system.cfg (it's 9 lines of text); open the file /etc/emulationstation/es_system.cfg; paste the text to second last line (of course, as separate sentences as in the source; it must be before </systemList> tag and after </system> tag). Here also you will need super user permission.

                              9. Finally convert shutdown and reboot scripts within "~/Retropie/roms" into executable's by the commands:
                                a. chmod +x ~/RetroPie/roms/power/ashutdown.sh
                                b. chmod +x ~/RetroPie/roms/power/reboot.sh

                              10. Restart and you are done!

                              Really need some help with this.... Not sure what to do with step 9. Ive tried deleting the existing content in these scripts and adding the above... But no joy

                              I keep getting a message saying permission denied. Can anyone help

                              1 Reply Last reply Reply Quote -1
                              • mituM
                                mitu Global Moderator
                                last edited by

                                @Jste84 said in Power On/Off Option in Main Menu:

                                I keep getting a message saying permission denied. Can anyone help

                                What are the permissions on those files ? Run

                                ls -l  ~/RetroPie/roms/power/
                                

                                and post the output.

                                J 1 Reply Last reply Reply Quote 0
                                • J
                                  Jste84 @mitu
                                  last edited by Jste84

                                  @mitu edit

                                  Total 64
                                  -rwxr-xr-x 1 pi pi 36 Apr 26 03:30 ashutdown.sh
                                  -rwxr-xr-x 1 pi pi 46 Apr 26 04:08 reboot.sh

                                  mituM 1 Reply Last reply Reply Quote 0
                                  • mituM
                                    mitu Global Moderator @Jste84
                                    last edited by

                                    @Jste84 said in Power On/Off Option in Main Menu:

                                    -rwxr-xr-x 1 pi pi 36 Apr 26 03:30 ashutdown.sh
                                    -rwxr-xr-x 1 pi pi 46 Apr 26 04:08 reboot.sh

                                    The files are already executable, so there's no need to run the chmod command.

                                    J 1 Reply Last reply Reply Quote 0
                                    • J
                                      Jste84 @mitu
                                      last edited by Jste84

                                      @mitu ok but when... I select the option to restart or shutdown on the menu... I get a message saying permission denied..

                                      I've Def done something wrong..

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        Jste84
                                        last edited by

                                        Is anyone able to help? I

                                        C 1 Reply Last reply Reply Quote 0
                                        • C
                                          che_don_john @Jste84
                                          last edited by

                                          @Jste84 said in Power On/Off Option in Main Menu:

                                          Is anyone able to help? I

                                          Have you tried resetting the permissions for the two scripts? Seemed to work for me. Try:

                                          sudo chown -R pi:pi /home/pi
                                          

                                          I'd really love to be add a third option for restarting Emulation Station. I added another .sh file to the rom folder called 'restart' and tried the following scripts:

                                          #!/bin/bash
                                          
                                          sudo restart -r now
                                          

                                          and

                                          #!/bin/bash
                                          
                                          sudo es-restart -r now
                                          

                                          No success with either. Any ideas?

                                          mituM 1 Reply Last reply Reply Quote 0
                                          • mituM
                                            mitu Global Moderator @che_don_john
                                            last edited by

                                            @che_don_john said in Power On/Off Option in Main Menu:

                                            sudo restart -r now

                                            There's no such command. You maybe want to run sudo reboot ?

                                            C 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.