Modify a safe shutdown script.
-
@cyperghost @mediamogul, I REALLY want to thank you for all your help.
I'm trying to change careers to Linux admin, and the RetroPie has been my "Carrot" for learning the OS.
Gradually, I'm picking the stuff up, but responses with information like what is supplied here do more than help me get a toy working, it's something I plan to use for the rest of my life.
I can only Bury my nose in a CompTIA book for so long before I need some hands on, and this is exactly what I needed.
Thank you.
-
Glad it worked out for you.
-
So, I love Python over Bash...
but I cant convert one over the other....
Any Ideas how to convert this to python?
-
@mediamogul I am using the original safe shutdown part...
import RPi.GPIO as GPIO import os import time ###look at the GPIO for the Button Switch to be depressed GPIO.setmode(GPIO.BCM) GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.wait_for_edge(3, GPIO.FALLING) def main(): while True: es-close() def es-close(): os.system("/etc/killes.sh") while True: print((es-close)) time.sleep(1) os.system("shutdown now")
and a very slightly modded es shutdown code
#!/bin/bash ############################## #This Script was created by # #meleu on the retropieforums.# ############################## # Check if EmulationStation is running. Finish the script if doesn't. espid="$(pgrep -f "/opt/retropie/supplementary/.*/emulationstation([^.]|$)")" || exit 0 # the "sed" command below isn't a crypted message :), it's just a trick to # make $emucall regex-safe to use in the "pgrep -f" below. emucall="$(sed '4!d; s/\([\\"]\|[[:alnum:]_]\+=[^ ]* \)//g; s/[][(){}^$*.|+? ]/\\&/g' /dev/shm/runcommand.info)" # 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 0.5 fi kill "$espid" wait "$espid" sleep 0.5
-
I'm not understanding how or where to fix the problem of the kintaro 9000 case not saving metadata.
Pi Model or other hardware: Pi 3b
Power Supply used: 5.1v 2.5a
RetroPie Version Used: 4.3.17
Built From: Pre made SD Image on RetroPie website, updated to 4.3.17
USB Devices connected: dongle for wireless keyboard
Controller used: Official PS3 Controller -
@quackwalks Do you by chance have a large number of roms scraped?
-
@drakaen391 I do have a large number of roms scraped.
-
@quackwalks that could be the issue, increase the wait time a few seconds because emulationstation takes more time to save the meta data if there are alot of scrapped roms
-
@drakaen391 said in Modify a safe shutdown script.:
increase the wait time a few seconds
A static wait time really isn't a good idea for something like this. If you use something similar to the while statement in my example above, it will always take as as much time as it needs, no matter what the circumstances.
-
@drakaen391 About your posted codings.... Does the wait command works in your case? @mediamogul and his while-loop by monitoring PID status is imho better ...
wait can only be used on child processes out of the own subshell
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.