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.

    PM2 Alternative

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 4 Posters 4.1k Views 3 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.
    • N Offline
      nuckinfutz
      last edited by nuckinfutz

      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

      Step 1.
      Create a text file that’s called mm.sh in the MagicMirror folder. Add the following lines to that file

      cd /home/pi/MagicMirror
      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.

      Step 2.

      Create an empty file on your desktop call mm.desktop
      open the file with your text editor and copy the following into it

      [Desktop Entry]
      Version=x.y
      Name=MagicMirror
      Comment=This is my comment
      Exec=/home/pi/MagicMirror/mm.sh
      Icon=/home/pi/Pictures/icon.png
      Terminal=false
      Type=Application
      Categories=Utility;Application;

      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

      /home/pi/.config/autostart

      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
      1 Reply Last reply Reply Quote 0
      • C Offline
        Chiumanfu
        last edited by

        This didn’t work for me. Running Raspbian Jessie lite. There is no file /home/pi/.config/autostart
        There is one in /home/pi/.config/lxsession/LDXE/autostart but that did not work either. Various googling says the proper way of autostarting scripts in Jessie is systemd but it is overly complicated and I haven’t been able to figure it out.

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          nuckinfutz @Chiumanfu
          last edited by nuckinfutz

          @Chiumanfu autostart is a folder. You want to drop the mm.desktop file into that folder. Haven’t tried Jessie light but don’t know why it shouldnt work.

          It should have worked where you tried as well. POST the contents of your mm.desktop file

          1 Reply Last reply Reply Quote 0
          • bheplerB Offline
            bhepler Module Developer
            last edited by

            I used PM2 to manged the Motion process in my first mirror. That code was fairly unstable and would crash 2-3 times a day. PM2 was a decent solution for that problem.

            Now, I use it mostly out of habit. It also makes restarting the mirror process easy instead of having to reboot the entire Pi.

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

              Hi…i was also facing the same issue. So as per my experience you should try one in /home/pi/.config/lxsession/LDXE/autostart but that did not work either. Various googling says the proper way of autostarting scripts in Jessie is systemd but it is overly complicated.

              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