RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    SafeShutdown.py for NESPi Case+ (Video instead of Sleep 5s)

    Scheduled Pinned Locked Moved Help and Support
    safe shutdonespi case +video splash
    7 Posts 3 Posters 758 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.
    • A
      almulder
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • A
        almulder
        last edited by

        What about using sudo sync?

        1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator
          last edited by

          Isn't the script created by the vendor (Retroflag) ? If so, why don't you ask them ?

          1 Reply Last reply Reply Quote 0
          • A
            almulder
            last edited by

            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.

            mituM 1 Reply Last reply Reply Quote 0
            • mituM
              mitu Global Moderator @almulder
              last edited by

              @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 ?

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

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

                https://retropie.org.uk/forum/topic/17506/tutorial-get-text-output-from-bash-files-into-your-python-script/2

                @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!

                1 Reply Last reply Reply Quote 2
                • A
                  almulder
                  last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • 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.