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.5k 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 @barrymossel
      last edited by

      @barrymossel That's interesting!
      That's because ScummVM creates itself a bash call.

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

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

        That's because ScummVM creates itself a bash call.

        I would change this sentence to: "That's because runcommand starts ScummVM through a bash call."

        ;-)

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

          @meleu Ready for quick'n'dirty coding? :)

          what about a kill $(expr $emupid + "1")
          of course you check before if pid is active :)

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

            @cyperghost that behavior reported by @barrymossel was the reason why I was killing the emulator with -9 (SIGKILL). When you kill a bash script with SIGKILL it kills all its child processes.

            But I realized that this isn't a good approach for retroarch, because it wouldn't save the .srm file...

            Looks like there are room for more improvements on that script. Will post something soon. (edit: or maybe you can do it yourself: just check if the first string on that 4th line is bash, if yes, kill the process with -9)

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

              Ehm, I was wondering: does it even matter that ScummVM doesn't exit to ES before shutdown? Is there any ScummVM meta data anyway? Or wouldn't meta data from games you played before ScummVM be saved either?

              meleuM 2 Replies Last reply Reply Quote 0
              • meleuM
                meleu @barrymossel
                last edited by

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

                Or wouldn't meta data from games you played before ScummVM be saved either?

                Yes for this question.

                • Useful topics
                • joystick-selection tool
                • rpie-art tool
                • achievements I made
                cyperghostC 1 Reply Last reply Reply Quote 2
                • cyperghostC
                  cyperghost
                  last edited by cyperghost

                  @meleu Hmm... and if you make case selection?
                  Are you sure there are no other caveeats? I must admit I'm not very common with the how to kill-a-process method.

                  okay... I will try :)
                  It's not tested, i have no access to my Pi now... So just coded out of brain (Please make the code look better... I use lot's of ifs.... much to much!)

                  emupid="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.')"
                  emu_com="$("${emupid%% *}")"
                  emupid="$(pgrep -f "$emupid")" 
                  
                  if [[ "$emu_com" == "bash" ]] && [[ "$emupid" ]]; then
                      kill -9 $emupid && sleep 4
                  fi
                  

                  You've to check also the PID.... because runcommand.info isn't deleted in ES caroussel mode after emulator is running :)

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

                    @barrymossel That's the question. You will losse all your progress in metadata saving if anything goes wrong.

                    But to be true.... I'm satisfied with 1.56 - the rest are rare usecases (imho)

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

                      @meleu
                      Annother suggestion

                      [[ "$(ps -p $(expr $emupid + "1") -o comm=)" == "scummvm" ]] && kill $(expr $emupid + "1")
                      

                      That's the way I would do... this is just an idea...
                      I tested this ... worked to kill one additional process with name "scummvm" but I'm not sure if this will always work!

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

                        @barrymossel Can you please test this script here: https://ghostbin.com/paste/a29wx

                        edit: I mean, test with ScummVM. ;-)

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

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

                          @barrymossel Can you please test this script here: https://ghostbin.com/paste/a29wx

                          edit: I mean, test with ScummVM. ;-)

                          Nope, didn't exit to ES and did not save lastplayed from game I started before.

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

                            @barrymossel I knew I made promise do not interact with this code by maybe you can try this one 1.57b - it's just a dirty workaround!

                            Feel free to test!

                            @meleu
                            I don't getting it why it does not work.
                            In generell I would try to detect PPID and then use ps command to find all PIDs stared by PPID.

                            meleuM B 2 Replies Last reply Reply Quote 0
                            • meleuM
                              meleu @cyperghost
                              last edited by

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

                              • Useful topics
                              • joystick-selection tool
                              • rpie-art tool
                              • achievements I made
                              cyperghostC 1 Reply Last reply Reply Quote 1
                              • B
                                barrymossel @cyperghost
                                last edited by

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

                                @barrymossel I knew I made promise do not interact with this code by maybe you can try this one 1.57b - it's just a dirty workaround!

                                Feel free to test!

                                I just started a massive scrape, so I won't turn the RPi off now. Depending on when the scrape ends I will try it later or tomorrow evening.

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

                                  @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

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

                                    @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 Reply Quote 1
                                    • B
                                      barrymossel @cyperghost
                                      last edited by

                                      @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...! :)

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

                                        @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
                                        • cyperghostC
                                          cyperghost
                                          last edited by cyperghost

                                          @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

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

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