Mausberry Shutdown Script Doesn't Save Metadata
-
@lostless
damn! I'm not getting what's wrong! Let's try this:sudo bash -x /etc/switch.sh & 2> /home/pi/script-debug.txt
And then press the f%#&ing button. Pretty please... :)
It should turn off your pi...
-
@meleu aaaaaaaaaaaaaannnnnnnddddd...................
...........NO GOOD. >:( sorry man.
-
+ GPIOpin1=23 + GPIOpin2=24 + echo 23 /etc/switch.sh: line 22: echo: write error: Device or resource busy + echo in + echo 24 /etc/switch.sh: line 24: echo: write error: Device or resource busy + echo out + echo 1 + file=/sys/class/gpio/gpio23/value + sleep 30 + inotifywait -qq -e modify /sys/class/gpio/gpio23/value
the readout of that and its stuck. My terminal has not finished what its doing.
-
@lostless are you able to use IRC? maybe it's better than this forum for an online conversation... :P
edit I'm at #retropie at irc.freenode.net
-
@meleu never used IRC. But willing to learn. Just need a client I assume? and somehow the #retropie is relevant somehow.
-
@lostless let's continue here then. Is your terminal "frozen"? I mean, the script didn't stopped, right?
-
@meleu i figured out irc. I'm there
-
@lostless Great. On your irc client, perform these commands:
/server irc.freenode.net /join #retropie
-
@meleu im in, i wasnt kidding. LOL
-
@lostless I can't see any lostless there. What's your nickname?
-
#!/bin/bash emucall=$(sed -n 4p /dev/shm/runcommand.info) emupid=${emucall#* } pos=$(expr ${#emucall} - ${#emupid}) $emupid=$(pgrep -f -n ${emucall:0:$pos}) kill $emupid
The code sniplet above should still do the job as it was introduced for a few days and was titled "complex" - it isn't ;)
It's robust string operation and searches for first occurence for space and then kills the latest process :)
The using of this regex in that way isn't maintainable imho for someone who isn't deep in this thing :) That's really nerdy now.But your outfindings are great but do this only for ScummVM? I think to introduce the
-n
switch in pkill command will do the job :) without playing around with RegEx. -
I've posted something above.
I'm happy with your outfindings but I would prefer two ways.a version with the inotify and a version without :)
I will use your code sniplets also for my newest build (but I will no use a mausberry - the platine is much to big)
To introduce a new bash windows with selectable options... Is it forced to be in first instance. Mean I can see it as on overlay due an emualtor? Do you know? -
Now testing v1.5b (with the loop fix):
- Shutdown from ES normally (play game, return to ES, verify "Last Played" updated, then button)
PASS -Last Played
saved prior to successful shutdown - Shutdown from ES during video screensaver (play game, return to ES, verify "Last Played" updated, wait for screensaver to start, then button)
PASS -Last Played
saved prior to successful shutdown (although there was a delay after pushing the button before the video stopped...) - Shutdown system while playing a game (RetroArch) (play game, return to ES, verify "Last Played" updated, play a different game, then button while still in game)
PASS -Last Played
saved prior to successful shutdown (the previous game as well as the one I was playing when I shut down both saved to the list.Sleep
delay still needs tweaked, takes a long time to start shutting down ES after exiting a game) - Shutdown system while playing a game (non-RetroArch) (play game, return to ES, verify "Last Played" updated, play a different game, then button while still in game)
PASS -Last Played
saved prior to successful shutdown (previous game and active game both saved metadata)
COMPLETE SUCCESS!
I'm very happy you guys! You came forth and solved my problem! I'm going to try tweaking the
sleep
command a little, but for the most part.. yay!! I don't have the ScummVM system installed on my Pi, so I can't test any further if you guys try to come up with a solution for that. Thank you so much!!! Should I mark asresolved
or are you guys still going to try tackling this further? - Shutdown from ES normally (play game, return to ES, verify "Last Played" updated, then button)
-
@hansolo77 If its solved for you, then by all means. @meleu is just trying to make a script that is more efficient on the cpu
-
I think the delay I found with the video screensaver comes from it waiting to start shutting down until AFTER the current playing video finishes. I just went to shutdown the system to make a backup of the working SD card, and a new video had just started, so I watched and waited until the current video stopped, then it shut down. Not a big deal, just something I noticed.
-
@hansolo77 when you are on IRC and see me (meleu) there, feel free to contact me and we will make more tests to "fix" that infinite loop checking the button pressing every single second.
Feel free to mark it as solved if it works for you. I am (was?) just trying to find a strong solution, for every scenario.
-
By all means. If a prettier solution can be had, it's for the better of everybody. Maybe we can even send a message over to the folks at Mausberry: "Hey, you guys should update your 'setup' webpage to include a blurb about our new script working if your goal is to use the circuit in a RetroPie setup". Of course, you're not their yet if you still wanna tinker.
And yeah, so long as my seedbox is online, I'm always in that chat forum (along with a dozen or so others). I do a lot of idlerpg for some of my private torrent trackers, and like to keep chatrooms open that I go to for help. Most of the time it's @Rookervik chatting up in there, but every now and then I see names I recognize like @cyperghost , @herb_fargus , @lilbud :)
-
@hansolo77 said in Mausberry Shutdown Script Doesn't Save Metadata:
Most of the time it's @Rookervik chatting up in there, but every now and then I see names I recognize like @cyperghost , @herb_fargus , @lilbud :)
It's only ever a few people chatting even though 70+ people could be in the room. It's usually quiet the rest of the time
-
@meleu said in Mausberry Shutdown Script Doesn't Save Metadata:
Feel free to mark it as solved if it works for you. I am (was?) just trying to find a strong solution, for every scenario.
I think so, but I'm pretty sure that your solution (ScummVM fix) is already in usage by @hansolo77 - I asked you (yesterday is wrong!) for a few hours of using the sniplet. I'm just reading that more and more people rip out parts of these scripts for different other usecases.
@meleu About giving the user the best experience: Add the latest version(s) posted in this topic to the "Usefull topic index". I think most (mausberry) people find it usefull. There are still other selling products (Powerblock PetRetBlock or some selfmade things). Maybe the Pi4 (maybe 2018 but rather 2019) will contain a power switch.
Out of this is code pieces I created a PID detector for ES and all emulators Garbage: PID Detector. It gives report of an running emulator and detects running ES and output both PID numbers. Out of this it is pretty easy to perform a simple escpae keypress just
kill $espid
. So we have full control over ES ... we can restart ES, quit ES, system reboot and system shutdown now :)@hansolo77 might you recheck if your script contains this line? If yes then it's a working version equal to @meleus upcoming, without the optimzing in sleep timer.
emupid="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.')"
Otherwise there might be issues with some emulators like ScummVM.About the telling mausberry to optimzie their bash script. Well no.... RetroPie and ES is just a special usecase. The mausberry script is working 100% in all usecases without installing an extra tool. So to follow unix philosopie - keep it simple and working and one tool for one usecase.
As me and @meleu (afaik) do not even possess a mausberry switch it's a bit difficult to test such scripts. We could run them and give anecho 1 > /sys...
but then we still do not have insights about user permission... and I think we are the latest man on earth who say. "Do what I say...", we just make suggestions.At last I have to say thank you to meleu for his constant help in caveeats and making suggestions. This is really a nice guy.
Download of latest version 1.56 is here
-
@cyperghost - Yes I am using the version with that line:
emupid="$(sed -n 4p /dev/shm/runcommand.info | tr -d '\\"' | tr '^$[]*.()|+?{}' '.')"
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.