Launch script when exit Emulationstation
-
@Assomnia If you have selected to autostart emulation station, kodi or pixel at boot in the RetroPie-setup scripts, yes.
-
@Rascas I don't have the file autostart.sh there :/
-
@Assomnia If you don't have its because you didn't selected the autostart option in RetroPie.
There are many ways to do what you want, but it depends on how you are starting your system. -
I actually would like to start in console and launch a .sh automatically at startup (couldn't manage that either by the way).
And then this script allows me to launch kodi, emulationstation or startx by just pressing a button. I'm running the pi in a psp therefore the buttons are connected to the GPIO (works fine).
The script allowing me to launch the softs works well but I have to launch it manually (for now I have a keyboard attached).
The aim is to launch the soft via the buttons and once I quit the soft I go back to the shell and the script starts again allowing me to launch something else if I want to.I hope I was clear enough :/
-
@Assomnia Why don't you just select to autostart Emulation Station ? You then have options there in Ports menu to launch either Kodi or Pixel or whatever. Much easier. When you exit one of the programs, it goes back automatically to ES again.
-
Don't know man, had quite a few issues here and there and I had the idea to do it this way. I don't have that much of knowledge on linux and the soft. Didn't know that I could start ES at boot.
I installed everything this way and didn't take the retropie image because I couldn't get the wifi to work in kodi then...
Was a mess.
Finally this solution is almost working just for a few things.Trying to boot my psp and run the script auto. Exit kodi the script starts. Exit ES the script starts and I'm done. Just can't find the way
-
@Assomnia Man, if you don't have the coding skills, just select the ES autostart option, much easier, it is pretty much what most people do.
-
@Rascas Coding skills are necessary for that ? I mean it's just a question of which file is involved when exit and edit that no ?
-
There is no file involved in everytime you exit programs (plural). But of course you can create a script to run one program and run anything else after.
If you just want to run a program/script whatever, and you aren't using one of RetroPie autostart options, you can add it to /etc/rc.local, everything in this file is run at the end of boot proccess, user independent. ~/.bashrc runs programs/scripts/etc when the relative user logs in, everytime. -
@Assomnia didn't
/home/pi/.bashrc
work for what you want? -
@meleu Nop I tried but didn't work out.
I actually changed a bit my script and added a new line. Make the thing working but probably it isn't that "clean" so to speak :
#!/bin/bash clear echo -e "Welcome\x1b[31m Asso'\x1b[0m : $(date)" echo -e "---------------------------------" echo -e "- Press TRIANGLE ▲ - Kodi" echo -e "- Press SQUARE ■ - EmulationStation" echo -e "- Press CIRCLE \033[1mO\033[0m - StartX" echo -e echo -e "- Press Any Key - Back to shell" echo -e "---------------------------------" echo -e read -s -N 1 answer if [ "$answer" == $'\e' ]; then echo "Kodi is Starting !" kodi bash /home/pi/loading.sh elif [ "$answer" = $'a' ]; then echo "EmulationStation is Starting" emulationstation bash /home/pi/loading.sh elif [ "$answer" == $'\x7f' ]; then echo "StartX is Starting" startx else clear echo "Back to Shell !" exit fi
-
@Assomnia Please use a code block for code snippets or data will be lost (as characters will be interpreted as styling)
I amended your post.
-
@BuZz Sorry man, first time here, I will be carefull next time
Thanks
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.