Stop/Start process when launching rom

Home Forums RetroPie Project Everything else related to the RetroPie Project Stop/Start process when launching rom

RetroPie has a new website and forum. Please visit for the new site. The new forum is located at This forum is left here as a read-only archive.

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of supersirlink supersirlink 3 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #4100
    Profile photo of supersirlink

    I have a Mausberry shutdown circuit that has a bash script that runs in the background to sense when the power button is pressed and shut down the pi.

    It actually slows down certain roms to where I have to bump the overclock to the maximum. Its a little excessive.

    So what I would like to know is if it is possible to stop the script when launching a rom, then start it back up when returning to emulation station.

    Profile photo of smartroad

    I wonder if it would be possible to use the scripts that start an emulator to kill the process before the emulator starts and then restart it once it fininishes?

    Profile photo of supersirlink

    I was wondering that myself, not sure exactly how to do that…

    Or if there was a better way to watch for the pins… The original is a bash script:

    #this is the GPIO pin connected to the lead on switch labeled OUT
    #this is the GPIO pin connected to the lead on switch labeled IN
    echo "$GPIOpin1" > /sys/class/gpio/export
    echo "in" > /sys/class/gpio/gpio$GPIOpin1/direction
    echo "$GPIOpin2" > /sys/class/gpio/export
    echo "out" > /sys/class/gpio/gpio$GPIOpin2/direction
    echo "1" > /sys/class/gpio/gpio$GPIOpin2/value
    while [ 1 = 1 ]; do
    power=$(cat /sys/class/gpio/gpio$GPIOpin1/value)
    if [ $power = 0 ]; then
    sleep 1
    sudo poweroff
    Profile photo of bgianpetro

    Which ROMs are you experiencing problems with when this script is running? I’m using the same poweroff circuit, but I haven’t put any serious play time into any one ROM yet so I’m wondering what triggers it.

    You could potentially try sleeping longer than one second to check the status of the pin. Maybe bump it up to like 10 seconds or so. Yes, your shutdown could take 10 seconds longer to complete, but that would probably be worth it if it didn’t interfere with your game play.

    Profile photo of supersirlink

    Shadowgate was the NES game I noticed it immediately with… The music is all distorted and choppy…Mario is fine, till you get going quickly and there are several enemies… SNES games are worse… It almost undos the mid level over-clock…

    Bumping the sleep up higher helps, Shadowgate is not as choppy, but it is noticeable enough still that you can hear in the music when it recycles… What I have not tried yet is seeing if I increase the sleep and if bumping the over-clock a little more will help…

    I posted on the raspberry pi forums as well and it was suggested there that I look into finding a script that does the same but uses polling or interrupts and it not BASH based… So I am going to explore that as well…

Viewing 5 posts - 1 through 5 (of 5 total)

Forums are currently read only - please visit the new RetroPie forums at

Skip to toolbar