How to restart ES from a script?
-
@TMNTturtlguy said in How to restart ES from a script?:
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$"
-
@BuZz Solid work!
Thank you -
@BuZz What is your prefered method?
pkill or killall? I think pkill offers more room for changes. -
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).
-
@cyperghost pkill so it can kill emulationstation running from any path.
-
@BuZz
Ufff... that was hard stuff! -
@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.
-
Wait a moment...
-
@TMNTturtlguy did you reboot ? you may want to
sudo rm /tmp/es-restart
also. -
There is a problem after launching the first time. Will check.
-
@BuZz There seems to be a problem with the one lost PID!
I did not update but I'm facing the same problem! -
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.
-
@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
-
@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.
-
@TMNTturtlguy if your script wants to edit that file it will need to use
sudo
as user scripts are no longer run as root. -
@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
-
you can please check permission of your
Restart Script
in retropiemenu.
It must be set to pi. -
@cyperghost another beginner questions, how do i check that?
-
@TMNTturtlguy
Because the sh und rp files are called via bash. I'm not 100% sure if this can cause errors. if you never entered SSH as root it's very unlikely you have the wrong permission set.Sorry late here
ls -al
in retropiemenue -
@cyperghost everything is set to pi
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.