How to restart ES from a script?
-
@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
-
@cyperghost said in How to restart ES from a script?:
pkill -f "/emulationstation$"
Worked here when I just tested.
-
@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
-
@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). -
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
-
@BuZz
Thank you I will remember that command!
Very usefull :) -
@TMNTturtlguy I will check....
I tested all scripts 2 two 3 times... all runing fine -
@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
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.