• 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 restart

Scheduled Pinned Locked Moved Unsolved Troubleshooting
4 Posts 3 Posters 1.2k 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.
  • B Offline
    BKeyport Module Developer
    last edited by Jan 2, 2020, 4:30 AM

    I’m wondering how this was done initially, and how to get it to happen again…

    When I installed a test copy of MagicMirror on my Test Raspberry, the software would auto-restart upon any changes to config.js. On my live copy, it does not do this… How was this done, and how can I get that back? I use PM2 to launch currently, although I don’t think it was being used on the test copy.

    Thanks!

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

    S 1 Reply Last reply Jan 2, 2020, 4:42 AM Reply Quote 0
    • S Offline
      sdetweil @BKeyport
      last edited by Jan 2, 2020, 4:42 AM

      @BKeyport this is a pm2 function, it ‘watches’ the file… we request that function, but its not working for some reason… it DOES work on mac, but nowhere else…

      could u open an issue on pm2 function not watching for config file changes…

      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
        last edited by BKeyport Jan 2, 2020, 5:48 AM Jan 2, 2020, 5:47 AM

        Hmm. interesting. I didn’t think the test copy was using PM2 when that was working. It stopped working when I set up PM2 the rest of the way per instructions…

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

        1 Reply Last reply Reply Quote 0
        • E Offline
          ember1205
          last edited by ember1205 Jan 2, 2020, 9:24 PM Jan 2, 2020, 9:24 PM

          There’s a REALLY simple way to do this using a script and a cron job.

          From the pi user, execute:

          sudo nano /bin/mmreload.sh
          

          Paste the following contents into that file:

          #!/bin/sh
          
          if [ /home/pi/MagicMirror/config/config.js -nt /home/pi/.pm2/pids/mm-0.pid ]; then
          /usr/bin/pm2 restart mm
          fi
          

          Save it (CTRL-X) and then give it execute permissions like this:

          sudo chmod +x /bin/mmreload.sh
          

          From the pi user, execute the following:

          crontab -e
          

          In the crontab file, add the following line:

          0,30 * * * * /bin/mmreload.sh  > /dev/null 2>&1
          

          Save the file (CTRL-X if you’re using nano).

          This will check the MM ‘pid’ file against the config.js file to see if the configuration file has been edited since the mirror was last started (it will check at the top and bottom of every hour). If the config file has been edited, it will restart MM and use the new configuration file.

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