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

    Multi Switch Shutdown Script!

    Scheduled Pinned Locked Moved Ideas and Development
    shutdown scriptshutdown switchcyperghost
    272 Posts 40 Posters 115.8k 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.
    • cyperghostC
      cyperghost @vivesladron
      last edited by

      @vivesladron What do you want to do?

      V 1 Reply Last reply Reply Quote 0
      • V
        vivesladron @cyperghost
        last edited by

        @cyperghost I want to do that


        but using your script

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

          @vivesladron then change the delieverd scripts from YouTube with calls according to help in multi_switch e.g. bash /path/to/multi_switch.sh --es-restart & to restart ES properly.

          1 Reply Last reply Reply Quote 1
          • V
            vivesladron
            last edited by

            Ok
            I designed my power button menu
            photo_2019-02-18_12-11-44.jpg
            And I edited es_systems.cfg
            <system>
            <name>power</name>
            <fullname>Power</fullname>
            <path>/home/pi/RetroPie/scripts</path>
            <extension>.rp .sh</extension>
            <command>/home/pi/RetroPie/scripts/multi_switch.sh --es-poweroff</command>
            <platform/>
            <theme>power</theme>

            Is that a good option to do it?
            Will it save metadata and shutdown the system?

            How can I run it directly without the next screen?
            photo_2019-02-18_12-11-50.jpg

            Thank you!

            1 Reply Last reply Reply Quote 0
            • Drakaen391D
              Drakaen391
              last edited by

              try changing the path to the full path to the script, to see if that works

              RPi B & RPi 3B OC (Now Raspberry pi 4b 8gb)
              Retropie (Latest Stable)
              PiBox with Wind Tunnel Cooling System

              V 1 Reply Last reply Reply Quote 0
              • V
                vivesladron @Drakaen391
                last edited by

                @Drakaen391 Thanks I’ll try that

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

                  @vivesladron Do following

                  on es_systems

                  <system>
                  <name>power</name>
                  <fullname>Power</fullname>
                  <path>/home/pi/RetroPie/scripts</path>
                  <extension>.sh</extension>
                  <command>bash %ROM%</command>
                  <platform/>
                  <theme>power</theme>
                  

                  Then put your script files into /home/pi/RetroPie/scripts

                  nano "/home/pi/RetroPie/scripts/PowerOff.sh

                  #Poweroff Script by cyperghost
                  /home/pi/RetroPie/scripts/multi_switch.sh --es-poweroff &
                  

                  nano "/home/pi/RetroPie/scripts/Restart ES.sh"

                  #Restart EmulationStation by cyperghost
                  /home/pi/RetroPie/scripts/multi_switch.sh --es-restart &
                  

                  That should work.

                  V 1 Reply Last reply Reply Quote 0
                  • V
                    vivesladron @cyperghost
                    last edited by

                    @cyperghost

                    That’s perfect
                    Thanks!

                    What if I want only poweroff by pressing just once from the power menu?

                    I didn’t check @drakaen391 suggestion yet

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

                      @vivesladron

                      What if I want only poweroff by pressing just once from the power menu?

                      Not possible - therfore someone has to change the code of EmulationStation.
                      You've got the same behaviour with KODI. One file to start but you have to enter the "system" and to start the single "ROM" file ;)

                      V 1 Reply Last reply Reply Quote 1
                      • V
                        vivesladron @cyperghost
                        last edited by

                        @cyperghost
                        I'm running the ROMs from a USB drive and I'm having problems with the scripts

                        /home/pi/RetroPie/scripts/PowerOff.sh: line 2 /home/pi/RetroPie/scripts/multi_switch.sh: Permission denied

                        I tried with chmod +x but no difference
                        Do you know how to fix it?

                        Thanks

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

                          @vivesladron Shure... just add bash command inside the scripts

                          so it will look like
                          bash /home/pi/RetroPie/scripts/multi_switch.sh --es-restart &

                          V 1 Reply Last reply Reply Quote 0
                          • V
                            vivesladron @cyperghost
                            last edited by

                            @cyperghost

                            So easy!
                            Thank you!
                            :)

                            1 Reply Last reply Reply Quote 0
                            • RionR
                              Rion
                              last edited by

                              @cyperghost Hi! Is your script compatible with mini-mods NesPi Fan Controller?

                              Github link to the script

                              FBNeo rom filtering
                              Mame2003 Arcade Bezels
                              Fba Arcade Bezels
                              Fba NeoGeo Bezels

                              1 Reply Last reply Reply Quote 0
                              • EfriimE
                                Efriim
                                last edited by

                                I really appreciate this script and have used it since before I registered to the forums here.

                                Since I have had the same retropie build for a while and I uninstalled two or three other shutdown scripts before installing this one.

                                I like that I can exit the dreamcast emulator without having to use the controller. I was wondering about when I press the reset button to do this. I get this error:

                                rc.local[__]: /opt/RetroFlag/multi_switch.sh: line 63: kill: (___) - No such process
                                

                                Is this normal behavior, and can I fix it?

                                I was also wondering about the fan_shutdown additional script.
                                When I turn my pi off, say using the Emulationstation menu to shutdown; the fan always stays on until I hit the switch on my case; Was the fan_shutdown script meant to turnoff the fan in that usage? If so what do I need to do to get it to work properly?
                                Thanks, @cyperghost

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

                                  @Efriim This could happen if the kill command fails because the PID was closed already and the kill commands leads to a already closed process.
                                  You can add a > /dev/null 2>&1 to python script in rc.local to get rid of it.

                                  The fan script is needed for some old NESPi cases. Some users report the fan is still blowing without it. So your description sounds like that it can help in this case. I've a SNES case and I do not need it.

                                  EfriimE 1 Reply Last reply Reply Quote 0
                                  • EfriimE
                                    Efriim @cyperghost
                                    last edited by Efriim

                                    @cyperghost
                                    I think I didn't describe the fan concisely. I was suggesting that the fan should be shutdown with the system e.g. sudo poweroff, and without having to get up and hit the powerswitch. What you say makes sense, that the fan wouldn't shutdown even when hitting the power switch on some cases.
                                    I have Retroflag MegaPi Case.

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

                                      @Efriim You may add the shutdown script according to the github description

                                      1. Install fan_shutdown script: cd /lib/systemd/system-shutdown/ && sudo wget https://raw.githubusercontent.com/crcerror/ES-generic-shutdown/master/shutdown_fan && sudo chmod +x shutdown_fan
                                      2. Install raspi-gpio with sudo apt install raspi-gpio
                                      3. The shutdown_fan is setted to GPIO4 as standard
                                      4. Therefore you might edit with sudo nano /lib/systemd/system-shutdown/shutdown_fan

                                      The script will be executed miliseconds before shutdown and will cut off power and stops the fan from everlasting blowing.

                                      EfriimE 1 Reply Last reply Reply Quote 0
                                      • EfriimE
                                        Efriim
                                        last edited by Efriim

                                        I'm trying the different GPIO for the shutdown_fan as it isn't doing anything. I'll update if I am successful. The fan is not connected to the gpio however it is connected to the board that connects to the GPIO. I tried GPIO set 1,2,3,4,5,7,8,10 none did as I wanted it to do. Hitting the powerswitch turns off the fan as per normal.

                                        1 Reply Last reply Reply Quote 0
                                        • EfriimE
                                          Efriim @cyperghost
                                          last edited by Efriim

                                          @cyperghost Hi, along with the script and its shutdown function working for dreamcast. A new feature of the reicast emulator is to save the rtc setting to emu.cfg when invoking the exit by pressing the exit hotkey. Using the script reset button to exit the emulator does, so successfully however it doesn't save the rtc settings. Meaning I have the set time/date screen until I make a clean exit with the controller and this lasts for a month or so. Do you think we will be able to add this type of exit to the script for reicast?

                                          I meant here that the reset button to exit reicast works and I am happy and proud to use this script. If there was a way to passthrough a command to reicast to initialize the poweroff where it saves the rtc, I would too like to know this.

                                          mituM cyperghostC 2 Replies Last reply Reply Quote 0
                                          • mituM
                                            mitu Global Moderator @Efriim
                                            last edited by

                                            @Efriim said in Multi Switch Shutdown Script!:

                                            A new feature of the reicast emulator is to save the rtc setting to emu.cfg when invoking the exit by pressing the exit hotkey

                                            Are you sure ? The RTC is saved in the NVRAM file (BIOS/dc/dc_nvmem.bin), not in the emu.cfg file.

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