Read the statement by Michael Teeuw here.
pm2 doesnt work with crontab
-
@sdetweil
Weird, I do not have /var/log/syslog.
Even did a find for it nothing, popped up…pi@Pixie:~ $ ls -laF total 348 drwx------ 15 pi pi 4096 Nov 10 15:36 ./ drwxr-xr-x 3 root root 4096 Sep 30 19:18 ../ -rw------- 1 pi pi 9080 Nov 10 13:17 .bash_history -rw-r--r-- 1 pi pi 220 Sep 30 19:06 .bash_logout -rw-r--r-- 1 pi pi 3523 Sep 30 19:06 .bashrc drwx------ 13 pi pi 4096 Nov 7 18:22 .cache/ drwx------ 22 pi pi 4096 Nov 8 12:57 .config/ drwx------ 3 pi pi 4096 Nov 7 17:49 .dbus/ drwxrwxr-x 2 pi pi 4096 Sep 30 19:17 Desktop/ drwx------ 2 pi pi 4096 Nov 7 23:11 Documents/ -rw-rw-r-- 1 pi pi 0 Nov 7 20:00 .gitconfig -rw-rw-r-- 1 pi pi 81 Nov 7 18:24 .gtkrc-2.0 -rw-rw-r-- 1 pi pi 222126 Oct 27 18:52 install.log drwx------ 4 pi pi 4096 Sep 30 19:18 .local/ drwxrwxr-x 16 pi pi 4096 Nov 8 12:54 MagicMirror/ -rwxrwxrwx 1 pi pi 320 Jun 12 2022 mm.json* -rwxrwxrwx 1 pi pi 38 Jul 16 2023 mm.sh* drwx------ 4 pi pi 4096 Nov 6 21:05 .mozilla/ drwxrwxr-x 4 pi pi 4096 Oct 27 18:30 .npm/ drwx------ 3 pi pi 4096 Oct 27 18:52 .pki/ drwxrwxr-x 5 pi pi 4096 Nov 9 17:24 .pm2/ -rw-r--r-- 1 pi pi 807 Sep 30 19:06 .profile -rw-rw-r-- 1 pi pi 66 Oct 27 19:22 .selected_editor drwxrwxr-x 4 pi pi 4096 Nov 10 15:43 shared/ -rw-r--r-- 1 pi pi 0 Sep 30 19:18 .sudo_as_admin_successful drwx------ 3 pi pi 4096 Nov 5 17:30 .vnc/ -rw------- 1 pi pi 50 Nov 9 17:24 .Xauthority -rw------- 1 pi pi 8238 Nov 9 19:32 .xsession-errors -rw------- 1 pi pi 7945 Nov 9 17:24 .xsession-errors.old -
@plainbroke Instead of piping the output to a blackhole, maybe pipe it to a logfile which you can interrogate to see why the
pm2 startis not working? -
About /var/log/syslog.
Debian does not use that anymore, already since a while.
As far as I understand it, you will need to get familiar with journalctl.
For cron jobs try this:$ journalctl --since "1 hour ago" --unit cron.service $ journalctl -f -u cron.serviceHappy hunting.
-
@evroom,
I get that nothing is found, when I run either of your suggestions.@mumblebaj
Explain piping, Please… -
@plainbroke piping is a technique of stitching together multiple commands to accomplish a task
The vertical bar is called the pipe character
Which takes the output of the left side and presents it as input to the right side , so its like forming a pipeWhen I want to find all the MagicMirror processes running in the background I do this
ps -efThis give the processes and the command line used to start them
But is a lot of dataSo I can filter that with grep , and I can pass in data on its stdin
ps -ef | grep -i MagicMirrorThat gives just the rows of the process list with MagicMirror on them
But if I want to kill them I need the process id on each row
That’s the second value on each row
I can use the awk command to get thatps -ef | grep -i MagicMirror | awk ‘{ print $2}’Now I have the process ids and can issue the kill command with them
ps -ef | grep -i MagicMirror | awk ‘{ print $2}’ | xargs sudo kill -9 -
@plainbroke said in pm2 doesnt work with crontab:
@evroom,
I get that nothing is found, when I run either of your suggestions.The
journalctl -fshows the current activities.
Simular totail -f <filename>.
So when there are none, you will see none.
Use that when you know that a cron job is going to occur anytime soon.
The--since "1 hour ago"searches for activities in the last hour.
Change to, for example--since "24 hours ago"for activities in the last 24 hours.
When nothing comes out, then indeed nothing happened (during the time period you are searching in).Other
--sinceoptions:"today" "00:20" "2025-11-12" "2025-11-12 07:30:00" -
@plainbroke Afternoon. What I was saying was that instead of sending your current output to a blackhole,
>/dev/null >2&1, i meant sending it to a log file:
30 07 * * 6,0 /usr/local/bin/pm2 start mm >> /home/pi/mon.log 2>&1. This will send the output of the command/usr/local/bin/ pm2 start mmto a log file residing at/home/pi/mof.log. You can then interrogate this log file to see if there were any errors when the command was executed.So, by pipe I meant redirect the output to somewhere.
-
@mumblebaj
@sdetweil
@evroom
Thank you all for the information.
I did not get to use it BUT I will save this information, so I do not have to ask again.
I woke up this morning and crontab -e had started my MM like old times… It also shutdown MM last night like it used to…
Tech is great when it does not try to give me a headache, trying to figure it out…Thanks again guys for all your help.
I think I will close this as solved.
Just Jeff -
@plainbroke awesome! Thanks for the feedback
