• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Auto Reload on Config File Change

Scheduled Pinned Locked Moved Troubleshooting
11 Posts 4 Posters 3.8k 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.
  • B Offline
    BKeyport Module Developer
    last edited by Jul 31, 2020, 1:28 AM

    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 Offline
      ember1205
      last edited by Jul 31, 2020, 2:18 AM

      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 Offline
        mjurgens
        last edited by Jul 31, 2020, 6:28 AM

        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

        B 1 Reply Last reply Jul 31, 2020, 2:34 PM Reply Quote 0
        • M Offline
          mjurgens
          last edited by Jul 31, 2020, 10:54 AM

          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 Jul 31, 2020, 1:52 PM Reply Quote 0
          • S Away
            sdetweil @mjurgens
            last edited by Jul 31, 2020, 1:52 PM

            @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

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • B Offline
              BKeyport Module Developer @mjurgens
              last edited by Jul 31, 2020, 2:34 PM

              @mjurgens can you explain the inotify setup? Sounds interesting.

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

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 1 / 2
              1 / 2
              • First post
                10/11
                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