I’m not sure what the benefit of PM2 is. In my mind if the mirror crashed the error will need to be fixed and the Pi rebooted. In the event of a power outage the Pi will reboot on its own. This is a simpler way to autostart MM2
In my case I’m running a 7" RPi touchscreen display connected to a RPi v3 running Raspbian Jessie via GPIO pins and the HDMI connector. I am supplying power to both the display and the RPi via a single 2.5v USB power supply. For me, I need to be aware of power consumption.
When I first started I installed PM2 and after some headaches I got it running. It seemed like overkill in my mind even without my need to watch out for power hungry daemons. I figured there must be an easier way. After a lot of searching and trying different things here is what I came up with. It’s very simple and doesn’t carry any of the overhead that PM2 does.
Here’s my solution
Create a text file that’s called mm.sh in the MagicMirror folder. Add the following lines to that file
DISPLAY=:0 npm start
Now save the file.
Right click on it and select Properties. Make sure its set as “executable by anyone” Now close the properties panel.
Create an empty file on your desktop call mm.desktop
open the file with your text editor and copy the following into it
Comment=This is my comment
If you’ve left everything as the defaults when installing MM2 you wont need to change anything.
Save this file and place a copy of it in
That’s it. Reboot and your mirror should load each time you reboot your Pi.
Definitely saves CPU usage thereby cutting down on power usage. There is also less to get “borked” up.
- It has been reported that this doesn’t work with Jessie Lite. This method depends on prior loading of startx