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 42.8k 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.
    • cyperghostC
      cyperghost
      last edited by

      let me test...

      1 Reply Last reply Reply Quote 0
      • BuZzB
        BuZz administrators
        last edited by BuZz

        or to work with emulationstation running from any path. (eg with emulationstation-kids etc).

        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

        cyperghostC 1 Reply Last reply Reply Quote 1
        • cyperghostC
          cyperghost
          last edited by cyperghost

          Works fine

          touch /tmp/es-restart; killall -e "/opt/retropie/supplementary/emulationstation/emulationstation"
          
          1 Reply Last reply Reply Quote 0
          • cyperghostC
            cyperghost @BuZz
            last edited by cyperghost

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

            pkill -f "/emulationstation$"

            That let's restart just 2 PIDs... Does not work!

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

            runs fine all 3 PIDs are up to date


            Man ... I even wrote use the tty1 outputs. So indeed the relauch script was killed

            BuZzB TMNTturtlguyT 2 Replies Last reply Reply Quote 0
            • BuZzB
              BuZz administrators @cyperghost
              last edited by

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

              pkill -f "/emulationstation$"

              Worked here when I just tested.

              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

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

                @BuZz Wait I post output in a few minutes...

                pi@retropie:~ $ ls /tmp
                es-restart  omxplayerdbus.root  omxplayerdbus.root.pid
                pi@retropie:~ $ ps -a
                  PID TTY          TIME CMD
                  862 tty1     00:00:00 bash
                  867 tty1     00:00:00 bash
                  868 tty1     00:00:00 emulationstatio
                  874 tty1     00:00:00 emulationstatio
                  877 tty1     00:00:13 emulationstatio
                  990 pts/0    00:00:00 ps
                

                The command pkill

                pi@retropie:~ $ pkill -f -e "/emulationstation$"
                emulationstatio killed (pid 868)
                emulationstatio killed (pid 877)
                

                check with ps -a

                pi@retropie:~ $ ps -a
                  PID TTY          TIME CMD
                  862 tty1     00:00:00 bash
                  874 tty1     00:00:00 emulationstatio
                 1001 tty1     00:00:08 emulationstatio
                 1071 pts/0    00:00:00 ps
                

                worked now... sorry... but 2 PIDs alive
                If PID 874 in my current setup will be killed than ES is wrecked.

                Thank you

                BuZzB 1 Reply Last reply Reply Quote 0
                • BuZzB
                  BuZz administrators @cyperghost
                  last edited by BuZz

                  @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
                  • TMNTturtlguyT
                    TMNTturtlguy @cyperghost
                    last edited by

                    @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

                    cyperghostC BuZzB 2 Replies Last reply Reply Quote 0
                    • cyperghostC
                      cyperghost
                      last edited by

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

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

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

                        1 Reply Last reply Reply Quote 0
                        • BuZzB
                          BuZz administrators @TMNTturtlguy
                          last edited by

                          @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

                          cyperghostC 2 Replies Last reply Reply Quote 0
                          • cyperghostC
                            cyperghost @BuZz
                            last edited by

                            @BuZz Solid work!
                            Thank you

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

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

                              BuZzB 1 Reply Last reply Reply Quote 0
                              • BuZzB
                                BuZz administrators
                                last edited by

                                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
                                • BuZzB
                                  BuZz administrators @cyperghost
                                  last edited by

                                  @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
                                  • cyperghostC
                                    cyperghost
                                    last edited by

                                    @BuZz
                                    Ufff... that was hard stuff!

                                    TMNTturtlguyT 1 Reply Last reply Reply Quote 0
                                    • TMNTturtlguyT
                                      TMNTturtlguy @cyperghost
                                      last edited by

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

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

                                        Wait a moment...

                                        1 Reply Last reply Reply Quote 0
                                        • BuZzB
                                          BuZz administrators @TMNTturtlguy
                                          last edited by BuZz

                                          @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

                                          cyperghostC 1 Reply Last reply Reply Quote 0
                                          • BuZzB
                                            BuZz administrators
                                            last edited by

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