MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Auto Reload on Config File Change

    Troubleshooting
    4
    11
    1121
    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.
    • M
      mjurgens last edited by

      On a fresh Raspbian install I load MagicMirror using the automatic script from sdetweil. It all works. One thing I noticed that was whenever I made a change to the config file, it automatically reloaded the config. This was great when I was playing around and constantly changing the config.

      I installed a few modules and made config changes.
      Then all of a sudden the changes to the config file stopped reloading automatically. I hadn’t even rebooted yet.

      I even deleted the MagicMirror and reinstalled but still no auto reload on config file change.

      How do you set that up again?

      S 1 Reply Last reply Reply Quote 0
      • S
        sdetweil @mjurgens last edited by

        @mjurgens are you using pm2 to start your mm?

        Sam

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 0
        • M
          mjurgens last edited by

          @mjurgens said in Auto Reload on Config File Change:

          automatic script from sdetweil

          I believe so. I think your script sets that up

          S 1 Reply Last reply Reply Quote 0
          • S
            sdetweil @mjurgens last edited by

            @mjurgens I have seen inconsistent results with change detection in pm2. I have not debugged it…

            Sam

            Create a working config
            How to add modules

            M 1 Reply Last reply Reply Quote 0
            • M
              mjurgens @sdetweil last edited by

              That probably explains it - a bug - it was strange how it suddenly just stopped working

              1 Reply Last reply Reply Quote 0
              • BKeyport
                BKeyport Module Developer last edited by

                It’s actually not a bug, or more like a bug with PM2 that it stops.

                the initial setup sets it up for --watch on the Pm2 line, when it restarts, it’ll eventually forget about that command line point.

                The "E" in "Javascript" stands for "Easy"

                1 Reply Last reply Reply Quote 0
                • E
                  ember1205 last edited by

                  I have a script that I run every 15 minutes via cron that checks for updates to the config file. It compares the time and date stamp of the config file against the time and date stamp of the pid file from when MM was started. If the config file is newer, it restarts MM.

                          if [ /home/pi/MagicMirror/config/config.js -nt /home/pi/.pm2/pids/mm-0.pid ]; then
                                  /usr/bin/pm2 restart mm
                          fi
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • M
                    mjurgens last edited by

                    What I have done to resolve this is installed the inotify-tools package and then setup a systemd service using the inotifywait command. This watches the config dir and on change triggers a “pm2 restart MagicMirror” command

                    BKeyport 1 Reply Last reply Reply Quote 0
                    • M
                      mjurgens last edited by

                      Actually, now that I set up my own auto restart, the pm2 one or whatever was doing it to start with has started working again.

                      So now the question is - how do I disable the preconfigured built-in auto restart?

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        sdetweil @mjurgens last edited by

                        @mjurgens edit the installers.pm2_MagicMirror_json file, and remove the watch: line and the trailing comma from the prior line. then do

                        # remove old version, not editable
                        pm2 remove 0
                        # cleanup saved task repo
                        pm2 save
                        # start new app
                        pm2 start installers/p2_MagicMirror.json
                        # save  app in restart repo
                        pm2 save
                        

                        Sam

                        Create a working config
                        How to add modules

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy