Restart ES via bash script!
-
Dear user the feature richest version is here posting #6 - please use this!
Edit: abolished version (yet functional)
Edit: lazy way
pkill -n emulationstatio
works exactly as the script ... just kills the latest process of ESKEEP CARE! You have to use
touch /tmp/es-restart
before using the restart commands!The trick is do not to kill all childs. I think it has something to do with the SDL framework.
Create file
home/pi/RetroPie/retropiemenu/Restart ES.sh
copy code in
make it executable, Restart ES manually via menu (hopefully last time)
ThenRestart ES
is selectable via RetroPie MenuThat was really hard to resolve!
#!/bin/bash # by cyperghost # 06/16/2017 # That was rocking hard! echo "Create es-restart" sudo touch "/tmp/es-restart" echo "Kill latest process PID of ES" sleep 3 kill $(pgrep -l -n emulationstatio | awk '!/grep/ {printf "%s ",$1}') sudo rm -f "/tmp/es-restart"
-
Was there a need for that language ?
-
@cyperghost awesome! Do I have your permission to add this code into my script for each of the Es change functions? I don't see the need for this in the retropie menu but rather right within my script for my use case. Thanks for figuring this out so quickly!
-
@BuZz No, but this drive me nuts .... I knew there is a solution!
- I listed the cpp code of ES
- watched services from RetroPie
- listed bash scripts from ES
- ...and yes ES checks for the existance of empty description files
So my first intension not to kill all child processes was 100% right but then I looked to @TMNTturtlguy script and in the file '/usr/bin/emulationstation' is the path to victory :)
Next time I use "EUREKA", right?
@TMNTturtlguy of course you can use this in your script. Just write a small contribution within. But please be aware of future changes in ES.
I'm very thankfull for your attempts because I asked me why you want to create empty files. But they are important for the boot staring progress.
Again: Please take care of future version. This script just kills the latest PID of ES!
-
This post is deleted! -
New coder new solution - @BuZz created a nice two liner
RetroPie-setup 4.2.8 needed (released 06/16/2017)
#!/bin/bash #Restart ES via Bash script v1.1 #06/16/2017 v1.0 #intensive rework done by BuZz all greetings fly out to him #special thank to @TMNTturtlguy for bug hunting! #version 06/17/17 slightly modified by meleu touch /tmp/es-restart pkill -f "/opt/retropie/supplementary/.*/emulationstation([^.]|$)"
It was tested several times by @BuZz @TMNTturtlguy and myself.
How to:
Copy this script to/home/pi/RetroPie/retropiemenu/´ Create bash file like
Restart ES`there
Give file permission and user pi:pi 755
Attention: RetroPie-setup < 4.2.8 (realease date 06/16/2017) should use
sudo -u pi touch /tmp/es-restart
That resolves problems with data permission!
Source:
https://retropie.org.uk/forum/topic/11043/how-to-restart-es-from-a-script/73 -
@cyperghost with the latest retropie-setup you can remove the
sudo -u pi
btw. -
done
-
@cyperghost (retropie-setup 4.2.8)
-
@BuZz clearly written!
Made Bash reworkpi@retropie:~ $ touch /tmp/es-restart pi@retropie:~ $ pkill -f -e "/opt/retropie/supplementary/.*/emulationstation$" emulationstatio killed (pid 999)
Only one PID killed! Three alive!
-
Hi,
Sorry I know this is an old thread but thought it was relevant to my question :)
Currently using 4.4
My script below, it works fine but it outputs:
rm: cannot remove '/tmp/es-restart': Operation not permitted
Script
#!/usr/bin/env bash rm /opt/retropie/configs/all/emulationstation/es_settings.cfg cp /opt/retropie/configs/all/emulationstation/emulationstation_swap/megadrivejapanmini/es_settings.cfg /opt/retropie/configs/all/emulationstation/ echo -e "\n\n\n Theme set to: Mega Drive Japan mini\n\n\n" sudo touch "/tmp/es-restart" sleep 3 kill $(pgrep -l -n emulationstatio | awk '!/grep/ {printf "%s ",$1}') sudo rm -f "/tmp/es-restart"
I currently have it to swap out the es_settings.cfg file but going to adapt it to search es_settings.cfg for the actual text command and change on the fly but for now I'm just trying to see what the options are for restarting ES after the first initial command has been activated.
Would just like to know if there is a new approach to restarting es without the use of es-restart ?
-
@paffley You should start a new topic.
-
@mitu said in Restart ES via bash script!:
@paffley You should start a new topic.
Thanks @mitu I solved my problem so no need to start a new topic. I also changed from rm/cp to the grep command to edit the existing es_settings.cfg
I did the above so I could change themes from within the retropie system whilst in Kiosk mode, also have done the same for screen ratio's and overlays :)
Cheers!
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.