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

    Mausberry Shutdown Script Doesn't Save Metadata

    Scheduled Pinned Locked Moved ControlBlock, PowerBlock & Co.
    mausberry
    251 Posts 10 Posters 99.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.
    • B
      barrymossel
      last edited by

      Sorry guys, I was busy drinking last night so I didn't test yet. Probably won't this evening. Will test later this weekend, but I am sure it works with the two of you working on it :)

      1 Reply Last reply Reply Quote 0
      • B
        barrymossel
        last edited by barrymossel

        Yup, seems to work. Thanks guys!

        1 Reply Last reply Reply Quote 2
        • lostlessL
          lostless
          last edited by

          @meleu @cyperghost Hey, somthing has happened. The script no longer works in retroarch. This is recent as I just updated and a week ago it worked. so Kodi it kills, and will shutdown emulation station properly if its open, but will no longer kick retroarch back to emulation station to exit. It just says terminated and shuts down without saving meta data. Looks like it just gives up and does the old way of shutting down. also @cyperghost , my reset on my nespi no longer works with retro arch, kodi is fine, because of what ever has happened. WHY DID I UPDATE!!!!! LOL

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

            @lostless can you please try this approach here?: https://retropie.org.uk/forum/topic/12895/ensuring-es-gracefully-finish-and-save-metadata-in-every-system-shutdown

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

              @meleu I’ll take a look when I get home. Just To Verify, this is what I have running in my script. Is this the most up to date?

              #!/bin/bash
              # Terminate any emulatorcall!
              # This works just for RetroPie!
              
               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    
              
              cyperghostC meleuM 2 Replies Last reply Reply Quote 0
              • cyperghostC
                cyperghost @lostless
                last edited by

                @lostless Please use the approach @meleu posted...
                The coding is the same but you don't need to modify the shutdown script itself!

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

                  @lostless please, when posting a code like that put it beetween codeblocks. More info here: http://commonmark.org/help/

                  • Useful topics
                  • joystick-selection tool
                  • rpie-art tool
                  • achievements I made
                  lostlessL 1 Reply Last reply Reply Quote 0
                  • lostlessL
                    lostless
                    last edited by

                    Looks like I’m missing the “wait”at the end compared to the script I use for the reset button. I’ll add it in and see if it helps. The issue I’m having though is not meta data related. As I said. When in ES, it funtions fine. It’s just when in retroarch that it no longer exits back to ES. Kodi is fine. It was working fine until yesterday.

                    1 Reply Last reply Reply Quote 0
                    • lostlessL
                      lostless @meleu
                      last edited by

                      @meleu heres the script im using now, same issue

                      #!/bin/bash
                      # Terminate any emulatorcall!
                      # This works just for RetroPie!
                      emucall="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.')"
                      # If there's an emulator running, we need to kill it and go back to ES
                      if [[ -n "$emucall" ]]; then
                          emupid="$(pgrep -f "$emucall")" 
                          pkill -P "$emupid"
                          kill "$emupid"
                          wait "$emupid"
                          sleep 5 # maybe it can be lesser
                      fi    
                      

                      and errors im getting trying to exit out of retroarch

                      pkill: killing pid 1 failed: Operation not permitted
                      pkill: killing pid 2 failed: Operation not permitted
                      ./exit.sh: line 9: kill: `': not a pid or valid job spec
                      ./exit.sh: line 10: wait: `': not a pid or valid job spec
                      
                      meleuM 1 Reply Last reply Reply Quote 0
                      • meleuM
                        meleu @lostless
                        last edited by

                        @lostless are you able to access your raspi via SSH while running an emulator?

                        If yes, I would like to ask you to do this:

                        1. launch a game.

                        2. access your raspi via SSH.

                        3. perform this command:

                        bash -x /path/to/the/emulator/killer/script.sh 2> debug.txt
                        
                        1. The command above generates the debug.txt file. Post this file on ghostbin or something similar.

                        Thanks.

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

                          @meleu https://ghostbin.com/paste/qa5ph
                          Just want to say thanks for all your help.

                          1 Reply Last reply Reply Quote 0
                          • lostlessL
                            lostless
                            last edited by

                            @meleu Sorry, looks like copying from nano cut a lot off text. heres a good copy
                            https://ghostbin.com/paste/q9zsm

                            meleuM 2 Replies Last reply Reply Quote 1
                            • meleuM
                              meleu @lostless
                              last edited by meleu

                              @lostless Thanks for this. I've found the problem. The runcommand.sh script changed a bit 3 days ago. I just have to adapt my Regular Expression and make it stronger. Wait a little, I'll try to sort it on our script.

                              • Useful topics
                              • joystick-selection tool
                              • rpie-art tool
                              • achievements I made
                              1 Reply Last reply Reply Quote 1
                              • meleuM
                                meleu @lostless
                                last edited by

                                @lostless I made my tests on a shell where there's no RetroPie installed and I believe it will work fine. But, you know, sh!t happens...

                                Try this version, please (feedback would be appreciated):

                                #!/bin/bash
                                # Terminate any emulatorcall!
                                # This works just for RetroPie!
                                emucall="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.' | sed 's/[^ ]*=[^ ]* //g')"
                                # If there's an emulator running, we need to kill it and go back to ES
                                if [[ -n "$emucall" ]]; then
                                    emupid="$(pgrep -f "$emucall")" 
                                    pkill -P "$emupid"
                                    kill "$emupid"
                                    wait "$emupid"
                                    sleep 5 # maybe it can be lesser
                                fi
                                

                                maybe I'll try to simplify that crazy line with a simpler regex later... ;-)

                                • Useful topics
                                • joystick-selection tool
                                • rpie-art tool
                                • achievements I made
                                lostlessL 1 Reply Last reply Reply Quote 1
                                • lostlessL
                                  lostless @meleu
                                  last edited by

                                  @meleu Its working in retroarch now im going to patch in into my mauseberry shutdown script!!!!!!!!!!!!!! YOU ARE THE MAN
                                  But kodi is not working
                                  https://ghostbin.com/paste/uqo6e
                                  debug of kodi not exiting.
                                  not a big deal if kodi does not work. Just kind of want my reset button to be the end all to go back to ES.

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

                                    @lostless said in Mausberry Shutdown Script Doesn't Save Metadata:

                                    But kodi is not working

                                    Here it goes another version, trying to get kodi too:

                                    # Terminate any emulatorcall!
                                    # This works just for RetroPie!
                                    emucall="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.' | sed 's/[^ ]*=[^ ]* //g')"
                                    # If there's an emulator running, we need to kill it and go back to ES
                                    if [[ -n "$emucall" ]]; then
                                        emupid="$(pgrep -f "$emucall" | tr '\n' ' ')"
                                        pkill -P "$(echo $emupid | tr ' ' ',')"
                                        kill "$emupid"
                                        wait "$emupid"
                                        sleep 5 # maybe it can be lesser
                                    fi
                                    
                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    cyperghostC 1 Reply Last reply Reply Quote 1
                                    • lostlessL
                                      lostless
                                      last edited by

                                      @meleu it works!!!!!! but now it looks like i blew out the gpio pin for my reset button. NOOOOOOOOOOOOOOOOO. That what i get for using a different build without gpio setup. GPIO DANGEROUS TO USE if not setup?

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

                                        @lostless sorry, I didn't understand your last question...

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

                                          @meleu has nothing to do with the script. that works . i was testing with another memory card without my gpio setup so i had 3.3v through a 10k resistor to the gpio. i think i burned out my gpio pins
                                          Permissions issue I think. Reinstalled and gpio is now working

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

                                            @meleu ;) So you see ... PID numbers are better to handle ;)
                                            But I think in the kodi-case a simple pkill kodi would be better. Or am I wrong? Sorry I never will get the result as I never will install Kodi on my Pi alongside with RetroPie ;)

                                            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.