MagicMirror² v2.5.0 is available! For more information about this release, check out this topic.

How to autorestart MM once a day



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



  • @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.



  • @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.



  • @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.