Read the statement by Michael Teeuw here.
pm2 doesnt work with crontab
-
This is all I use in my crontab -e
15 07 * * * pm2 start mm
30 21 * * * pm2 stop all
Shuts MM down at 9:30 pm
Starts MM backup at 7:15 am
EVERYDAY.
I have a Black background color and the bar at the bottom using black background which makes it look like the screen is off basically.
That way it doesn’t flood the room with light at night.
Also less read / writes to the ssd drive I use for my MM. -
@sdetweil
My old crontab does not work in debian 12 aka bookworm
Is there something i need to add to it to get it to work again?
Really liked how it worked and the fact that I was getting a fresh restart of mm every morning…15 07 * * * pm2 start mm 30 21 * * * pm2 stop all
Tried this too.
15 07 * * * pi pm2 start mm 30 21 * * * pi pm2 stop all
-
@plainbroke what userid did the pm2 jobs get created under?
-
@sdetweil
pi is my user. I know not very original or safe but it is on a closed network.
that is why I tried the pi user in the crontab.
and it shows up when I do crontab -l.
So I think it is setup under pi correctly.
Do I need to do it as root sudo crontab -e and use pi or root as the user? -
@plainbroke no. what fo the pm2 logs show?
pm2 logs --lines=xxx
xxx is number of most recent lines, default 15 -
you can do cron restart with pm2 too, see https://pm2.keymetrics.io/docs/usage/restart-strategies/
-
This post is deleted! -
@plainbroke i mean after cron trying to start
pm2set a cron entry for an hour from now stop MagicMirror and flush the logs
pm2 stop all
pm2 flushsee what the logs say then
-
@karsten13 yes, but he wants stop and start
-