MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    script or bash to exit MM and exit GUI and run a command in TTY mode

    Scheduled Pinned Locked Moved Development
    4 Posts 2 Posters 1.7k Views 4 Watching
    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.
    • A Offline
      AxLed Module Developer
      last edited by

      Hi to all,

      i am trying to extend my MM for a second purpose -> Retropie.
      Therefore i need a script or bash or any way to do the following:

      • exit MM (maybe exiting PM2 is also fine)
      • exit the Raspian / Pixel GUI (as retropie dont run in GUI Mode)
      • run the “emulationstation” command in the TTY terminal

      Does anybody has hints for me to do that. For the beginning i would be also ok to run a script manual by entering the commands in terminal.

      Thanks in advance.

      AxLED

      1 Reply Last reply Reply Quote 0
      • A Offline
        AxLed Module Developer
        last edited by AxLed

        Hi to all interested,

        i testet some hours and made little progress.

        There are following requirements:
        Tools:

        • pm2
        • xdotool

        Starting MagicMirror from Retropie works somehow, see the following lines:

        • add a MagicMirror.sh file in the fork folder of retropie with the following code
        #!/bin/bash
            echo "starting MagicMirror"
            sudo service lightdm start #to start GUI
            #pm2 stop emulationstation, final commands missing so far
            pm2 start mm #to start MagicMirror
            xdotool key Ctrl+Alt+F7 #to change to tty7 = Gui
        
        • make this file executable

        Starting Retropie from MagicMirror works somehow, see the following lines:

        • editing file /opt/retropie/supplementary/runcommand/runcommand.sh, change links from tty to tty1. Make sure owner and group ist root after editing

        • add a es.sh file in a folder of your choice with the following code

        #!/bin/bash
        echo 'starting Emulationstation/Retropie'
        sudo service lightdm stop #to quit GUI
        export DISPLAY=:0
        emulationstation > /dev/tty1 #to execute this command in tty1 where emulationstation/retropie runs
        
        • make this file executable
        • put this file into pm2

        Difficulties:
        I dont know how to put two .sh files into pm2 and set one to “start” and one to “stop”, if i only would have one of the to .sh files executed at one time (one .sh is for MagicMirror, second .sh is for emulationstation/retropie)

        AxLED

        1 Reply Last reply Reply Quote 0
        • R Offline
          Ramez
          last edited by

          put the first one in /home/pi/retropie/roms/ports and you can run it under ports section in ES

          the closing script is a bit tricky you can use MM module that excute a terminal command to exit like this one MMM-TouchButtons and config it like that

          {
            text: 'Exit MM',
            icon: 'skull',
            action: 'exec', 
            command: 'killall lightdm'
          }
          

          it should kicks you back to ES

          1 Reply Last reply Reply Quote 0
          • A Offline
            AxLed Module Developer
            last edited by

            @Ramez
            Thanks for your reply, i want to have only one app (either mm or Retropie/Emulationstation) run at one time due the pi ressources.

            But i will try your approach.

            AxLED

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy