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.

    How to autorestart MM once a day

    Scheduled Pinned Locked Moved Troubleshooting
    6 Posts 5 Posters 4.8k Views 5 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.
    • MaxPowerM Offline
      MaxPower
      last edited by

      Hi, I was trying to autorestart the mirror once a day. The problem is my twitter feed that stacks every 1-2 days. I was not able to fix it, only restart helps. I’ve added the cronjob (?) line, however, it doesn’t work for me.
      Can some one point me in to the right direction, how to do the auto restart with other options? PM2 or other?
      I need step by step, please.

      N 1 Reply Last reply Reply Quote 0
      • N Offline
        ninjabreadman @MaxPower
        last edited by

        @MaxPower It stacks every 1-2 days? I don’t quite understand what that means.

        In any case, what command are you using to restart? Are you trying to restart MM (recommended) or the RPi? If you have pm2 installed and managing your MM process, I suggest using pm2 restart mm. Whatever commend you choose, run it in Terminal first to ensure it will do what you intend.

        There are lots of videos and walkthroughs available online on how to use crontab.

        I recommend you then add the following crontab task:

        * 4 * * * pm2 restart mm
        

        This will restart MM every day at 4am (when I assume you’re not using it) so that it’s ready in the morning.

        Problem with config or JavaScript? Copy/paste it into JSHint.
        Check out the detailed walkthroughs on install, config, modules, etc.

        MaxPowerM 1 Reply Last reply Reply Quote 1
        • MaxPowerM Offline
          MaxPower @ninjabreadman
          last edited by

          @ninjabreadman thank you for the help!

          Sorry, I meant that my twitter modul stucks every day or so. I’m not sure why, but every other say one twit stuck and stays there forever until I restart MM. Sometimes it can be after 2-3 days sometimes several hours. So the esiest way I found is to restart the mirror every day.
          Thanks for the script, I added it to the cron, I hope it will work.

          E D 2 Replies Last reply Reply Quote 0
          • E Offline
            E3V3A @MaxPower
            last edited by

            @MaxPower Sound like it would be better to file an issue with the module developer github, to fix the problem, rather than have to restart you pi.

            "Everything I do (here) is for free – altruism is the way!"
            MMM-FlightsAbove, MMM-Tabulator, MMM-Assistant (co-maintainer)

            1 Reply Last reply Reply Quote 1
            • D Offline
              DaveChild @MaxPower
              last edited by

              @MaxPower said in How to autorestart MM once a day:

              I recommend you then add the following crontab task:

              * 4 * * * pm2 restart mm
              

              Sorry to bump this old topic, but I found this searching for how to restart MM automatically and the crontab line given isn’t quite correct. That line will restart MM every minute from 4am to 5am. The line to get it to run just once is something like:

              17 4 * * * pm2 restart mm
              

              That’ll run at 4:17 am only.

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

                @DaveChild also need to run the cron task under the user id that created the pm2 task… usually pi

                running under root (default) will fail

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                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