Read the statement by Michael Teeuw here.
Auto restart MagicMirror after x hours ?
-
Hi everybody,
After 5/6 hours my screen become black and i don’t find why.
For view MM i do launch :
pm2 restart mm
So for auto restart after 5 hours, i have create a cron :
* 5 * * * pm2 restart mm
don’t work… :(
but :
pi@raspmagicmirror1:~/MagicMirror $ tail -f /var/log/syslog | grep CRON Sep 12 19:12:02 raspmagicmirror1 CRON[5590]: (root) CMD (pm2 restart mm) Sep 12 19:12:04 raspmagicmirror1 CRON[5586]: (CRON) info (No MTA installed, discarding output)
So why MM don’t restart ?
Thx for help (sorry for poor english)
-
@smotx, here is a thread with a similar goal to restart from cron:
https://forum.magicmirror.builders/topic/6826/how-to-autorestart-mm-once-a-day/4 -
My cronjob looks like this:
0 6 * * * pm2 reload mm
and it is working just fine. Maybe try the reload instead of the restart command?
Also, I runcrontab -e
without sudo. -
Thanks for help.
I have installed gnome-schedule to manage from desktop mode with VNC.
-
I see your original problem. You have the cron job set to execute each day at 5am.
Here is the cron command for every five hours:
0 */5 * * * pm2 restart /home/piMagicMirror/mm.shI now have this running myself (every three hours).
Note: The leading 0 means that it will execute in the 0th minute of the hour.