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.2k 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.
    • denisuuD
      denisuu @cyperghost
      last edited by

      @cyperghost I'll try that though I'm pretty new to Linux so that would be a first time compiling anything, good way to learn!

      This the most I could delete without breaking functionality. Is it difficult to add the reset button to just reboot?

      Retroflag_Raspbian-Shutdown.sh

      Danke schön!

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

        @denisuu yes that is a stripped down version. Now use the if clause in line 28 and write your reboot command in. You can further strip down this if you want. Take care about the reset value I am not sure what it's default is. 0 or 1 just pretest with echo command.

        denisuuD 1 Reply Last reply Reply Quote 0
        • denisuuD
          denisuu @cyperghost
          last edited by denisuu

          I compiled raspi-gpio on OSMC and the script is working now!!! I wouldn't know how to further strip this down, it's a miracle I even got this far!

          The onlything left to do is the reboot button.

          When it's finished is it ok if I put them on Github? All credits to you ofcourse!

          cyperghostC 1 Reply Last reply Reply Quote 1
          • denisuuD
            denisuu
            last edited by

            It was just as simple as putting sudo reboot on the line you said! It seems the button doesn't work every time, sometimes I have to press twice but good enough! Maybe it's just the case...

            I put this here:
            https://github.com/Denisuu/OSMC_NesPi-SuperPi_Safe-Shutdown

            I haven't linked it anywhere so if you have any objections let me know!

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

              @denisuu said in Multi Switch Shutdown Script!:

              I compiled raspi-gpio on OSMC and the script is working now!!! I wouldn't know how to further strip this down, it's a miracle I even got this far!

              Nice job. This is IMHO the best solution to go

              When it's finished is it ok if I put them on Github? All credits to you ofcourse!

              Do as you like. I take a look to your git looks good.

              Excuse me for my late reply I was on vacation and the internet connection was terrible bad so there was just room for some phone messaging and email. For goodness SMS worked very good ;)

              1 Reply Last reply Reply Quote 1
              • C
                cotton
                last edited by

                I am just re-doing a new OSMC installation with Retropie embedded in it so I thought I would get a retroflag and finally put it in a case!

                @denisuu
                I followed your instructions on your git page. I have a question on step 1) You said I could run the command for OSMC as a one liner, but I got permission denied, I just had to run it as sudo in pieces; that worked until i got to the last command "make install". I get the following message:

                osmc:/usr/src/raspi-gpio$ make install
                gcc -DPACKAGE_NAME=\"raspi-gpio\" -DPACKAGE_TARNAME=\"raspi-gpio\" -DPACKAGE_VERSION=\"0.2\" -DPACKAGE_STRING=\"raspi-gpio\ 0.2\" -DPACKAGE_BUGREPORT=\"serge@raspberrypi.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"raspi-gpio\" -DVERSION=\"0.2\" -I.     -g -O2 -MT raspi-gpio.o -MD -MP -MF .deps/raspi-gpio.Tpo -c -o raspi-gpio.o raspi-gpio.c
                /bin/bash: gcc: command not found
                Makefile:361: recipe for target 'raspi-gpio.o' failed
                make: *** [raspi-gpio.o] Error 127
                
                

                Am I missing something?

                denisuuD 1 Reply Last reply Reply Quote 0
                • denisuuD
                  denisuu @cotton
                  last edited by

                  I'm not sure, I tried it a couple of days ago and it was working.

                  Maybe you can try and compile it from here? https://github.com/RPi-Distro/raspi-gpio

                  cyperghostC 1 Reply Last reply Reply Quote 1
                  • C
                    cotton
                    last edited by

                    Ok,

                    I reinstalled Retrosmc and that made it work. Works like a charm; if I had a way, id buy you both a drink.

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

                      @denisuu I lift your OSMC modification into first posting. Glad you compiled raspi-gpio to OSMC

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

                        Hi, noob here
                        I don't undestand 4 and 5 steps:

                        1. Now edit ES autostart with nano /opt/retropie/configs/all/autostart.sh and add script to like ....
                        2. /home/pi/RetroPie/scripts/multi_switch.sh --nespi+ & but BEFORE the last line emulationstatio #auto

                        What I need if I want to make a power off option in retropie menu?
                        photo_2019-02-12_15-41-50.jpg

                        Thanks

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