RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Check if game is running using command line

    Scheduled Pinned Locked Moved ControlBlock, PowerBlock & Co.
    command lineretropie 4.5fan control
    6 Posts 3 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hansiatisch
      last edited by

      Hi,

      i would like to power off my raspberry pi fan, as soon as i am not in-game any more and power it on again, whenever I launch a game.
      My question: Is there a way to determine (e.g. via command line) if there is any game opened/active independent from the currently used emulator.
      Btw: I have the latest retropie Image on the Raspi 3b+.

      Thanks for your Support.

      1 Reply Last reply Reply Quote 0
      • P
        petrockblog Global Moderator
        last edited by

        How is your fan connected to the RPi?

        H 1 Reply Last reply Reply Quote 0
        • H
          hansiatisch @petrockblog
          last edited by

          @petrockblog One wire of the FAN is connected to 5V pin. The other wire is connected to an n-channel mosfet, that is used as a switch for the FAN. I am using GPIO18 to control the mosfet, increase/decrease speed. So i am already able to control the FAN.

          1 Reply Last reply Reply Quote 0
          • P
            petrockblog Global Moderator
            last edited by

            You could run Bash commands for controlling the GPIO pin from within the run command script. A good starting point would be the last function within that script. The script is located at /opt/retropie/supplementary/runcommand/runcommand.sh. It gets called with every start and exit of an emulator.

            1 Reply Last reply Reply Quote 0
            • B
              backstander
              last edited by backstander

              You might also try using the runcommand-onstart and runcommand-onend scripts:
              https://retropie.org.uk/docs/Runcommand/#runcommand-onstart-and-runcommand-onend-scripts

              onstart runs before a game starts and onend runs after a game exits. Note: these on-scripts and the runcommand.sh will only work for emulators/games that launch through Runcommand. I believe just about everything on RetroPie using the Runcommand but their might be something that doesn't. Just a troubleshooting heads up for the future ;)

              1 Reply Last reply Reply Quote 1
              • P
                petrockblog Global Moderator
                last edited by

                I like that suggestion even more than mine :-)

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post

                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.