SafeShutdown.py for NESPi Case+ (Video instead of Sleep 5s)
-
So I have my unit in a NESPi Case+ with the SafeShutdown.py script installed and everything works fine.
So I have a question.
When this executes:
os.system("sudo killall emulationstation && sleep 5s && sudo shutdown -h now")I see there is a sleep function of 5 seconds, would it be safe to remove the sleep function and add a 5-10 second shutdown video instead? or does the sleep still need to be there and if so why?
So it would kill emulationstation then play video and then shutdown -h now
What about if your in the middle of a save and someone hits the button?
Is there any way to add a check to see if the system has data being written to the sdcard and to wait for it to finish before it shuts down. or am I over thinking it?
-
What about using sudo sync?
-
Isn't the script created by the vendor (Retroflag) ? If so, why don't you ask them ?
-
because they did not create it. I was hoping more experienced Linux people could help. Also the script is similar to other scrips that people use when they add a button to their setup so the question is not specific to the case, I only posted that to give all info and the script I was working with and what I was trying to accomplish.
-
@almulder said in SafeShutdown.py for NESPi Case+ (Video instead of Sleep 5s):
because they did not create it
Are you sure ? Then who created it and how did you install it ?
-
@mitu I think he is in some way right. The script is awfull written. For example they do Start it with RC.local but use sudo to kill emulationstation and again sudo to perform shutdowns.
You can take a look in their git .... There are so many issues and PR but no answer. That was the point I created a modified Python script for better user experience.
@almulder For the video question
That might work if you use a shutdown Video instead of sleep. But as i wrote the code is not well written. The whole shutdown will fail if there is no session oft emulation Station running! -
Ya I have been looking into python, but instead of 'sleep' replaced that with a 'sync;sync' to check if the system is being written to. (Was told this is much better to do it twice as the fist time it might wight some code back or something I cant remember why for sure. ) But it starts to play a video prior to the rest of the code., so the video starts and then while its playing the shutdown is started and the actual shutdown is not ran until it get info back that the video is finished. This way the video can be any length I want. :)
Going to look more into python and better methods of doing the shutdown. Once finished I plan to send them the code so they can update it. Any help is apreciated. :)
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.