• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Software Shutdown using Atxraspi

Scheduled Pinned Locked Moved Help and Support
atxraspishutdown
28 Posts 3 Posters 6.3k 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.
  • C
    crazydude2
    last edited by 19 Sept 2017, 17:48

    Hi

    Has anyone ever got the software shutdown running on atxraspi? I get to the step setting up permissions and get this error. Does anyone know what i am doing wrong?

    pi@retropie:/usr/local/bin $ sudo ls -la -rwxr-xr-x 1 root staff 580 Dec 29 17:59 softshutdown.sh
    ls: invalid line width: xr-xr-x

    These are the Instructions

    Also if anyone can point me to a topic about not loosing metadata when using this i would appreciate it. The topics i have found so far don't seem to work with this. I am using the interrupt method if this helps.

    Thanks in advanced

    C 1 Reply Last reply 19 Sept 2017, 18:23 Reply Quote 0
    • M
      mitu Global Moderator
      last edited by 19 Sept 2017, 17:50

      The command in the instructions is

      sudo chmod +x softshutdown.sh
      

      The command you pasted is wrong.

      C 1 Reply Last reply 19 Sept 2017, 18:38 Reply Quote 0
      • C
        cyperghost @crazydude2
        last edited by cyperghost 19 Sept 2017, 18:23

        @crazydude2 Please let's your issue talk here not in @meleu script

        What is your config?
        Are you using the python script or the bash script?
        What switch to you have momentary or rocker?

        Your ATX-switch does not properly shutdown ES and there is no chance to save metadata as it just sets a shutdown command! So use the instructions in this thread.

        C 1 Reply Last reply 19 Sept 2017, 18:35 Reply Quote 0
        • C
          crazydude2 @cyperghost
          last edited by 19 Sept 2017, 18:35

          @cyperghost HI

          I am using the python script and a momentary switch. What config do you want to know? I have tried them instructions but am still having issues. THanks for you help.

          1 Reply Last reply Reply Quote 0
          • C
            crazydude2 @mitu
            last edited by 19 Sept 2017, 18:38

            @mitu THanks. I have just realised i misunderstood what it means. I have run the command and now permissions are set to -rwxr-xr-x 1 root staff 611 Sep 18 21:44 softshutdown.sh

            When i try to run without sudo it says there is a permission issue. Is this correct? It doesnt seem to run on shutdown

            1 Reply Last reply Reply Quote 0
            • C
              cyperghost
              last edited by cyperghost 19 Sept 2017, 18:38

              @crazydude2
              Are you using an NPN transistor for software powerdown?

              I have run the command and now permissions are set to -rwxr-xr-x 1 root staff 611 Sep 18 21:44 softshutdown.sh

              That's correct as you are user pi?

              Just for asking? Are you using the RetroPie Image proviede here?

              C 2 Replies Last reply 19 Sept 2017, 18:40 Reply Quote 0
              • C
                crazydude2 @cyperghost
                last edited by 19 Sept 2017, 18:40

                @cyperghost Hi. Yes i am it is set up like this

                I have just got the command to work over ssh using sudo softshutdown.sh. it does not work without that. permissions are set to -rwxr-xr-x 1 root staff 611 Sep 18 21:44

                C 1 Reply Last reply 19 Sept 2017, 18:43 Reply Quote 0
                • C
                  crazydude2 @cyperghost
                  last edited by 19 Sept 2017, 18:42

                  @cyperghost Hi

                  Yes i am user pi. Yes i am using the 4.2 image provided here.

                  1 Reply Last reply Reply Quote 0
                  • C
                    cyperghost @crazydude2
                    last edited by 19 Sept 2017, 18:43

                    @crazydude2 That's okay... you don't have root permission, so you are using sudo command ... why have you a group named stuff?

                    1 Reply Last reply Reply Quote 0
                    • C
                      cyperghost
                      last edited by cyperghost 19 Sept 2017, 18:46

                      Can you edit python script with sudo nano /etc/shutdownirq.py?

                      C 1 Reply Last reply 19 Sept 2017, 18:49 Reply Quote 0
                      • C
                        crazydude2 @cyperghost
                        last edited by 19 Sept 2017, 18:49

                        @cyperghost Hi yes i can edit it. and i do not know why i have a group. I am not very experienced in this operating system so am trying to follow guides. Maybe one of them set it up

                        1 Reply Last reply Reply Quote 0
                        • C
                          cyperghost
                          last edited by cyperghost 19 Sept 2017, 19:00

                          At first try the solution posted by @meleu --> Posted here

                          If this does not work take the lines above


                          Okay.... in your python script:
                          Edit the line os.system("sudo poweroff") to os.system("sudo /etc/es_shutdown.sh")

                          copy this to /etc/es_shutdown.sh
                          then sudo chmod +x /etc/es_shutdown.sh

                          #!/bin/bash
                          # End Emulationstation if condition of running binary is true (v1.59)
                          # v1.0 07/21/17 by cyperghost - Inital run
                          # v1.1 07/22/17 - Added chown command to set right user permission for creating es-shutdown // cyperghost
                          # v1.2 07/23/17 - Some small improvments, easier to maintain, removed echo, removed else branch // cyperghost
                          # v1.5 07/27/17 - Great step to exit ES even if emulators is running by runcommand.sh are started // meleu
                          # v1.55 07/29/17 - all kudos go to @meleu for his alltime genious RegEx hack! // meleu
                          # v1.56 07/30/17 - All emulators will be detected. // meleu
                          # v1.58 08/02/17 - generel method: Use PPID to detect child PIDs now (ScummVM fix) // cyperghost
                          # v1.59 08/03/17 - nothing new, just polishing the code // meleu
                          # I just checked with SSH command - it saved my metadata! Maybe you need to extend sleeptimer!
                          # greetings @pjft for his famous favorits and @meleu for his RegEx sniplets and his constant help!
                          emucall="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.')"
                          if [[ -n "$emucall" ]]; then
                          emupid="$(pgrep -f "$emucall")"
                          pkill -P "$emupid"
                          kill "$emupid"
                          sleep 4
                          fi
                          espid="$(pgrep -f "/opt/retropie/supplementary/.*/emulationstation([^.]|$)")"
                          if [[ -n "$espid" ]]; then
                          touch /tmp/es-shutdown && chown pi:pi /tmp/es-shutdown
                          kill "$espid"
                          exit
                          fi
                          # End Emulationstation if condition of running binary is true
                          poweroff
                          C 1 Reply Last reply 19 Sept 2017, 19:23 Reply Quote 0
                          • C
                            crazydude2 @cyperghost
                            last edited by 19 Sept 2017, 19:23

                            @cyperghost Hi. I have just given this a go. Now when i press the shutdown button the status flashes and nothing happens then after a bit of time it is like the power has been cut.

                            C 1 Reply Last reply 19 Sept 2017, 19:28 Reply Quote 0
                            • C
                              cyperghost @crazydude2
                              last edited by cyperghost 19 Sept 2017, 19:28

                              @crazydude2
                              What did you try?

                              1. This one
                              2. or this one

                              Is your metadata saved in your usecase? What do you mean with "status flashes"?

                              C 1 Reply Last reply 19 Sept 2017, 19:33 Reply Quote 0
                              • C
                                crazydude2 @cyperghost
                                last edited by 19 Sept 2017, 19:33

                                @cyperghost I tried the 1st one which did not work and then the 2nd one causes it to just cut the power. The atxraspi has a status led which flashes when in shutdown. At a guess it times out and just cuts the power if its not received the success signal. Perhaps that shutdown script takes too long? Nothing seems to happen in retropi before the power just cuts. The rest signal still works so i assume its still going through the python script

                                C 1 Reply Last reply 19 Sept 2017, 19:37 Reply Quote 0
                                • C
                                  cyperghost @crazydude2
                                  last edited by cyperghost 19 Sept 2017, 19:37

                                  @crazydude2 So you press the button 4 seconds right?
                                  And then a shutdown is performed, right?

                                  Can you restart ES and type in SSH sudo /etc/es_shutdown.sh?
                                  ES should shutoff and metadata is saved.

                                  C 1 Reply Last reply 19 Sept 2017, 19:52 Reply Quote 0
                                  • C
                                    crazydude2 @cyperghost
                                    last edited by 19 Sept 2017, 19:52

                                    @cyperghost When i run from ssh i get this error message and then it shuts down
                                    pi@retropie:~ $ sudo /etc/es_shutdown.sh
                                    sed: can't read /dev/shm/runcommand.info: No such file or directory

                                    It seems to shutdown correct if no metadata has changed from the switch. For example freshly turned on and then off. If i load a game exit back to check it is in last played when i use the power switch it just cuts the power rather than shutdown

                                    C 1 Reply Last reply 19 Sept 2017, 20:04 Reply Quote 0
                                    • C
                                      cyperghost @crazydude2
                                      last edited by cyperghost 19 Sept 2017, 20:04

                                      @crazydude2 I have to take a look ... as I have not the atx here it's hard to suggest.

                                      If you can switch to the install bash script it would be much easier

                                      sudo wget https://raw.githubusercontent.com/LowPowerLab/ATX-Raspi/master/shutdownchecksetup.sh
                                      sudo bash shutdownchecksetup.sh
                                      sudo rm shutdownchecksetup.sh
                                      sudo reboot

                                      I guess the bash shutdown script can be changed to this ...

                                      with sudo nano /etc/shutdowncheck.sh
                                      https://ghostbin.com/paste/bo2vu

                                      C 1 Reply Last reply 19 Sept 2017, 20:29 Reply Quote 0
                                      • C
                                        crazydude2 @cyperghost
                                        last edited by 19 Sept 2017, 20:29

                                        @cyperghost Thanks for the help. This seems to work. I just need to remember to hold the button long enough as restart just shutdowns and leaves the atxraspi on which isn't ideal. Tomorrow i need to look into the software shutdown but i am not as worried about this as i probably wont use very often

                                        1 Reply Last reply Reply Quote 0
                                        • C
                                          cyperghost
                                          last edited by cyperghost 19 Sept 2017, 20:35

                                          @crazydude2
                                          I made a small rework to the script to make reboot and shutdown for this script available here

                                          For software shutdown with the transistor you have to edit
                                          sudo nano /opt/retropie/supplementary/emulationstation/emulationstation.sh
                                          delete all content and add new one posted down in this posting.

                                          be aware... if you update RetroPie you may loose this script! as it is part of the RetroPie package!

                                          Can you post your outfindings please?

                                          #!/bin/sh
                                          esdir="$(dirname $0)"
                                          while true; do
                                          rm -f /tmp/es-restart /tmp/es-sysrestart /tmp/es-shutdown
                                          "$esdir/emulationstation" "$@"
                                          ret=$?
                                          [ -f /tmp/es-restart ] && continue
                                          if [ -f /tmp/es-sysrestart ]; then
                                          rm -f /tmp/es-sysrestart
                                          sudo /usr/bin/local/softshutdown.sh 1
                                          sudo reboot
                                          break
                                          fi
                                          if [ -f /tmp/es-shutdown ]; then
                                          rm -f /tmp/es-shutdown
                                          sudo /usr/bin/local/softshutdown.sh 4
                                          sudo poweroff
                                          break
                                          fi
                                          break
                                          done
                                          C 1 Reply Last reply 19 Sept 2017, 21:07 Reply Quote 0
                                          20 out of 28
                                          • First post
                                            20/28
                                            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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received