Read the statement by Michael Teeuw here.
Multiple "Mirrors" from a single device
-
@sdetweil
so mm2.sh should/would be:
#!/bin/bash
cd ~/MagicMirror
export MM_CONFIG_FILE=config/config2.js
export MM_PORT=8081
npm run server
#DISPLAY=:0 npm startwhile mm.sh remains untouched
When I have this in place:
- instance #1 correctly displays on the screen attached to the MM host… tick
- i can also view instance #1 on a browser (on port 8080)… tick
- can view instance #2 in a browser (on port 8081)… tick
However, when I run mm2.sh while I am SSH’d to the MM, I am not returned to the command line so I can save the pm2 setup.
I just have a prompt saying “Ready to go! Please point your browser to http://ipaddress:8081”I have to Ctrl-C to cancel out, which then stops the server function and the #2 instance is no longer displayed
-
@DarrenO-0 in Windows when you want an app to run when started from the command prompt you do
detach command…
in linux you add and & as the last charactercomand… &
now… STOPPING those detached/background things are tough…
here is one value for pm2… it EXPECTS the script to blockand so you can kill it thru pm2 stop xxxx
BUT
pm2’s JOB is to start and app AND KEEP IT RUNNING…
so you kill it (ctrl-q) or it fails, pm2 will restart itSO, if you want both to run and want to do it manually, open a second ssh session
until you are happy and then let pm2 run them both -
-
@BKeyport
isn’t this to run two MM’s on a single display and have the second MM displayed from the 1920th pixel on the x axis?I’m wanting to run two MM’s, each instance on isolated displays - one on the display connected to the host in the traditional method and the other on a remote display like another computer, or TV with an in-built browser.
-
@DarrenO-0 and what does the status say?
pm2 status
pm2 logs 1 (or whatever the number is of the line for the second ) --lines=xxxx
where xxxx is the number of the most recent lines in the log for that appI have lots of apps on my desktop pm2
pm2 status output| id │ name │ mode │ ↺ │ status │ cpu │ memory │ ├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤ │ 1 │ MagicMirror │ fork │ 27 │ stopped │ 0% │ 0b │ │ 7 │ MagicMirror1 │ fork │ 279… │ stopped │ 0% │ 0b │ │ 0 │ Smart Mirror │ fork │ 31 │ stopped │ 0% │ 0b │ │ 3 │ checkarec │ fork │ 0 │ online │ 0% │ 3.5mb │ │ 6 │ smart-mirror │ fork │ 9 │ online │ 0% │ 3.5mb │ │ 5 │ smart-mirror ttt │ fork │ 10 │ stopped │ 0% │ 0b │ │ 4 │ start_alexa_bk │ fork │ 0 │ online │ 0% │ 3.5mb │ │ 2 │ startspot │ fork │ 328 │ stopped │ 0% │ 0b │ └────┴────────────────────┴──────────┴──────┴───────────┴──────────┴────────
the count under the circle coloum is restarts of that app
-
@DarrenO-0 the server side still provides access regardless of where the local display output is configured
AND if you run server mode, then the config for the local electron isn’t used
-
@DarrenO-0 said in Multiple "Mirrors" from a single device:
or TV with an in-built browser.
just heads up…
we use the latest Javascript language options
most/many/all TV’s do NOT have this browser version available and cannot be upgraded.
so the MM screen will be black (browser crashed)when I got here in 2017, I could run MM on my Samsung TV browser
not anymore -
@sdetweil
after running the mm2.sh script (runs as “npm run server”) and then I initiate a new SSH to the MM, I still only see a single instance (the original instance from mm.sh) of MM running when I issue a pm2 status command.
Although I can physically see the second MM displayed as desired in my browser, I’m not seeing the second instance via the pm2 status command. -
@sdetweil
Fair enough.
So i’ll have to have a physical computer like a Pi, NUC or MiniPC attached to the TV via HDMI to display the MM via that computer’s browser.
Not a big deal as the TV would be used for viewing TV channels and online streaming content anyway. -
@DarrenO-0 how did you add it to pm2 . just doing mm2.sh doesn’t
pm2 start xxxx
xxx is the mm2.sh
or the MagicMirror2.json
it should run and you should see with statusthen pm2 save so that it will be saved to the bootup start list