• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

How to restart ES from a script?

Scheduled Pinned Locked Moved Help and Support
scriptessystems.cfgrestart
111 Posts 5 Posters 39.9k 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.
  • B
    BuZz administrators @cyperghost
    last edited by BuZz 16 Jun 2017, 15:51

    @cyperghost use ps -fa as you can't tell what they are from that. probably parent bash scripts (which is correct - they shouldn't be killed).

    To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

    1 Reply Last reply Reply Quote 1
    • T
      TMNTturtlguy @cyperghost
      last edited by 16 Jun 2017, 15:52

      @BuZz @cyperghost

      touch /tmp/es-restart; killall -e "/opt/retropie/supplementary/emulationstation/emulationstation"

      runs fine all 3 PIDs are up to date

      When i use this in my script, it runs the first time. The second time i try to run it, the script crashes with error "cant remove /tmp/es-restart

      C B 2 Replies Last reply 16 Jun 2017, 15:54 Reply Quote 0
      • C
        cyperghost
        last edited by 16 Jun 2017, 15:52

        @BuZz
        Thank you I will remember that command!
        Very usefull :)

        1 Reply Last reply Reply Quote 0
        • C
          cyperghost @TMNTturtlguy
          last edited by cyperghost 16 Jun 2017, 15:54

          @TMNTturtlguy I will check....
          I tested all scripts 2 two 3 times... all runing fine

          1 Reply Last reply Reply Quote 0
          • B
            BuZz administrators @TMNTturtlguy
            last edited by 16 Jun 2017, 15:55

            @TMNTturtlguy said in How to restart ES from a script?:

            @BuZz @cyperghost

            touch /tmp/es-restart; killall -e "/opt/retropie/supplementary/emulationstation/emulationstation"

            When i use this in my script, it runs the first time. The second time i try to run it, the script crashes with error "cant remove /tmp/es-restart

            because custom retropie scripts are actually run as root - ill change that I think, but just make sure you create it owned by pi for now.

            sudo -u pi touch /tmp/es-restart
            pkill -f "/emulationstation$"

            To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

            C 2 Replies Last reply 16 Jun 2017, 15:56 Reply Quote 0
            • C
              cyperghost @BuZz
              last edited by 16 Jun 2017, 15:56

              @BuZz Solid work!
              Thank you

              1 Reply Last reply Reply Quote 0
              • C
                cyperghost @BuZz
                last edited by cyperghost 16 Jun 2017, 15:57

                @BuZz What is your prefered method?
                pkill or killall? I think pkill offers more room for changes.

                B 1 Reply Last reply 16 Jun 2017, 15:58 Reply Quote 0
                • B
                  BuZz administrators
                  last edited by 16 Jun 2017, 15:58

                  I have updated retropie-setup so user scripts will now be launched as a normal user without elevated permissions (can use sudo in a script if needed).

                  To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                  1 Reply Last reply Reply Quote 1
                  • B
                    BuZz administrators @cyperghost
                    last edited by 16 Jun 2017, 15:58

                    @cyperghost pkill so it can kill emulationstation running from any path.

                    To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                    1 Reply Last reply Reply Quote 0
                    • C
                      cyperghost
                      last edited by 16 Jun 2017, 16:05

                      @BuZz
                      Ufff... that was hard stuff!

                      T 1 Reply Last reply 16 Jun 2017, 16:31 Reply Quote 0
                      • T
                        TMNTturtlguy @cyperghost
                        last edited by 16 Jun 2017, 16:31

                        @cyperghost @BuZz i updated retropie-setup and now i can't run my script, and i also cannot do anything within the retropie setup script either. I enter restropie setup, it freezes up for a bit and then exits back to the retropie menu.

                        B 1 Reply Last reply 16 Jun 2017, 16:38 Reply Quote 0
                        • C
                          cyperghost
                          last edited by 16 Jun 2017, 16:38

                          Wait a moment...

                          1 Reply Last reply Reply Quote 0
                          • B
                            BuZz administrators @TMNTturtlguy
                            last edited by BuZz 16 Jun 2017, 16:38

                            @TMNTturtlguy did you reboot ? you may want to sudo rm /tmp/es-restart also.

                            To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                            C 1 Reply Last reply 16 Jun 2017, 16:45 Reply Quote 0
                            • B
                              BuZz administrators
                              last edited by 16 Jun 2017, 16:40

                              There is a problem after launching the first time. Will check.

                              To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                              1 Reply Last reply Reply Quote 1
                              • C
                                cyperghost @BuZz
                                last edited by cyperghost 16 Jun 2017, 16:45

                                @BuZz There seems to be a problem with the one lost PID!
                                I did not update but I'm facing the same problem!

                                1 Reply Last reply Reply Quote 0
                                • C
                                  cyperghost
                                  last edited by cyperghost 16 Jun 2017, 16:49

                                  No the first killall script runs in best condition!
                                  All 3 PIDs are running there!

                                  touch /tmp/es-restart; killall -e "/opt/retropie/supplementary/emulationstation/emulationstation"
                                  

                                  and I can execute @TMNTturtlguy script like usual behavior.

                                  B T 2 Replies Last reply 16 Jun 2017, 17:00 Reply Quote 0
                                  • B
                                    BuZz administrators @cyperghost
                                    last edited by BuZz 16 Jun 2017, 17:00

                                    @cyperghost the pkill isn't working as it also kills a needed parent process as the pattern matches a bash line which I missed.

                                    touch /tmp/es-restart
                                    pkill -f "/opt/retropie/supplementary/.*/emulationstation$"

                                    should sort it

                                    To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                                    1 Reply Last reply Reply Quote 0
                                    • T
                                      TMNTturtlguy @cyperghost
                                      last edited by 16 Jun 2017, 17:01

                                      @cyperghost @BuZz Ok, so I did the ps -a and killed the largest emulationstatio and i can at least navigate the menus again....so yes the pkill is causing the issue,

                                      Next issue is after the setup script update my script gives an error saying that '/opt/retropie/configs/all/emulationstation/es_systems.cfg' is write protected and the script errors out.

                                      B 1 Reply Last reply 16 Jun 2017, 17:04 Reply Quote 0
                                      • B
                                        BuZz administrators @TMNTturtlguy
                                        last edited by 16 Jun 2017, 17:04

                                        @TMNTturtlguy if your script wants to edit that file it will need to use sudo as user scripts are no longer run as root.

                                        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                                        T 1 Reply Last reply 16 Jun 2017, 17:14 Reply Quote 1
                                        • T
                                          TMNTturtlguy @BuZz
                                          last edited by 16 Jun 2017, 17:14

                                          @BuZz thanks that seems to work. New issue. When running

                                          touch /tmp/es-restart
                                          pkill -f "/opt/retropie/supplementary/.*/emulationstation$"

                                          the script works great, but when i press start and go to QUIT, the screen flashes back to my script and ES restarts. I can't navigate to exit or shutdown. I immediately see the script blue screen and restart ES. So this is not killing the /tmp/es-restart

                                          1 Reply Last reply Reply Quote 0
                                          53 out of 111
                                          • First post
                                            53/111
                                            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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received