• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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 95.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.
  • C
    cyperghost @meleu
    last edited by cyperghost 8 Feb 2017, 20:41 2 Aug 2017, 18:00

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

    @cyperghost I think pgrep scummvm (without -f) would be more effective thant that.

    OUTDATED !!

    Yes... but I'm finished with that code. But I think using ps as entry to extract PPID should work. So this is a sniplet coded yesterday with annother intention....
    Thank you :)

    What does happen if you use killall command instead of kill -9 or use killall in general?

    @barrymossel

    as meleu alread said pgrep would be the smarter approach!
    I just want to create failsafe methods but they aren't effective in CPU load :)

    so you have to change code line
    [[ "$(pgrep scummvm)" ]] && pkill scummvm
    or if you are just a killer without p
    [[ "$(pgrep scummvm)" ]] && kill "$(pgrep scummvm)"

    Sorry for being inconvinient

    C 1 Reply Last reply 2 Aug 2017, 19:38 Reply Quote 0
    • C
      cyperghost @cyperghost
      last edited by cyperghost 8 Feb 2017, 22:13 2 Aug 2017, 19:38

      @meleu @barrymossel @lostless
      I think that's it

      [[ "$(pgrep -P $emupid)" ]] && kill $(pgrep -P $emupid)

      So I would push to v1.58 give this a try! I tested with a bash that called a bash.... It worked great so far!

      I also updated the ES PID detector. It shows emulator call PID, PID of child processes and ES PID! @barrymossel You can use the PID detector to proof if all PIDs will be proper detected!

      So go... kill'em all (METALLICA??)

      B 1 Reply Last reply 3 Aug 2017, 07:51 Reply Quote 1
      • B
        barrymossel @cyperghost
        last edited by 3 Aug 2017, 07:51

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

        @meleu @barrymossel @lostless
        I think that's it

        [[ "$(pgrep -P $emupid)" ]] && kill $(pgrep -P $emupid)

        So I would push to v1.58 give this a try! I tested with a bash that called a bash.... It worked great so far!

        I also updated the ES PID detector. It shows emulator call PID, PID of child processes and ES PID! @barrymossel You can use the PID detector to proof if all PIDs will be proper detected!

        So go... kill'em all (METALLICA??)

        Will try tonight, when I find the time...! :)

        M 1 Reply Last reply 3 Aug 2017, 12:28 Reply Quote 0
        • M
          meleu @barrymossel
          last edited by 3 Aug 2017, 12:28

          @barrymossel please test this one: https://ghostbin.com/paste/adsrw

          It has the same logic as the solution above by @cyperghost , I just cleaned up the code. He will update his post soon.

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          1 Reply Last reply Reply Quote 1
          • C
            cyperghost
            last edited by cyperghost 8 Mar 2017, 17:43 3 Aug 2017, 16:40

            @meleu I agree - I think version 1.59 is a final version now.
            But please correct your ghostbin bash... there are small errors in... $emucall isn't definated - it should rather be $emupid

            @barrymossel It doesn't matter if you use 1.58 or 1.59. The logic is the same only the style of coding is different.

            Feel free to upgrade to v1.59 -- Final version

            M 1 Reply Last reply 3 Aug 2017, 18:32 Reply Quote 0
            • M
              meleu @cyperghost
              last edited by 3 Aug 2017, 18:32

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

              please correct your ghostbin bash... there are small errors in... $emucall isn't definated - it should rather be $emupid

              fixed! thanks!

              emucall is emucall and emupid is emupid. ;-)

              • Useful topics
              • joystick-selection tool
              • rpie-art tool
              • achievements I made
              C 1 Reply Last reply 3 Aug 2017, 18:40 Reply Quote 1
              • C
                cyperghost @meleu
                last edited by cyperghost 8 Mar 2017, 19:48 3 Aug 2017, 18:40

                @meleu
                No problem brother. I corrected it but used only emupid as variable :)
                But it is better to repost code according to your latest changes. So there is one version 1.59 around

                About using variables? You see I'm avoiding these and use just a bunch of them...
                Is there any difference? Speed up? Memory usage?

                I know it's better for clear code reading.... but is that effcient?

                1 Reply Last reply Reply Quote 0
                • B
                  barrymossel
                  last edited by 4 Aug 2017, 07:10

                  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 8 Jul 2017, 17:38 7 Aug 2017, 16:38

                    Yup, seems to work. Thanks guys!

                    1 Reply Last reply Reply Quote 2
                    • L
                      lostless
                      last edited by 11 Oct 2017, 06:33

                      @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

                      M 1 Reply Last reply 11 Oct 2017, 16:35 Reply Quote 0
                      • M
                        meleu @lostless
                        last edited by 11 Oct 2017, 16:35

                        @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
                        L 1 Reply Last reply 11 Oct 2017, 16:50 Reply Quote 0
                        • L
                          lostless @meleu
                          last edited by lostless 10 Nov 2017, 18:17 11 Oct 2017, 16:50

                          @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    
                          
                          C M 2 Replies Last reply 11 Oct 2017, 16:53 Reply Quote 0
                          • C
                            cyperghost @lostless
                            last edited by 11 Oct 2017, 16:53

                            @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
                            • M
                              meleu @lostless
                              last edited by 11 Oct 2017, 17:07

                              @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
                              L 1 Reply Last reply 11 Oct 2017, 22:51 Reply Quote 0
                              • L
                                lostless
                                last edited by 11 Oct 2017, 17:47

                                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
                                • L
                                  lostless @meleu
                                  last edited by 11 Oct 2017, 22:51

                                  @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
                                  
                                  M 1 Reply Last reply 11 Oct 2017, 23:09 Reply Quote 0
                                  • M
                                    meleu @lostless
                                    last edited by 11 Oct 2017, 23:09

                                    @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
                                    L 1 Reply Last reply 11 Oct 2017, 23:27 Reply Quote 0
                                    • L
                                      lostless @meleu
                                      last edited by 11 Oct 2017, 23:27

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

                                      1 Reply Last reply Reply Quote 0
                                      • L
                                        lostless
                                        last edited by 11 Oct 2017, 23:42

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

                                        M 2 Replies Last reply 11 Oct 2017, 23:58 Reply Quote 1
                                        • M
                                          meleu @lostless
                                          last edited by meleu 10 Dec 2017, 00:59 11 Oct 2017, 23:58

                                          @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
                                          • 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.

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