Hi guys,
Easy one for some I hope. Just want someone to explain what each of these do and if there should be any output? Seems the logs are always empty?
* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log
Additional question - How do I know the crons are running properly?
Solved! Go to Solution.
Hi there,
Those cron jobs are running and logging the output in those log files.
The first one is logging the cron jobs that have been ran, the second one is running the cron from /update/ and the last one is running the cron from the M2 command-line tool.
Best regards.
Gabriel
Hi there,
Those cron jobs are running and logging the output in those log files.
The first one is logging the cron jobs that have been ran, the second one is running the cron from /update/ and the last one is running the cron from the M2 command-line tool.
Best regards.
Gabriel
I have a similar question. My cron job appears to run in the cron_schedule table with success but magento.cron.log and the setup.cron.log are always empty, they don't have any data. Is this correct functionality? I thought the magento.cron.log was to show "Ran jobs by schedule"
Hi friend,
I got alerted to your question because I created this original question. It was a long time ago though, so a lot has changed and I stuck at it and I'm very familiar with the Linux command line and crontab now.
To answer your question, that particular cron log should always be empty. Reason being is because the -v flag on the grep command means "invert-match", so it writes all output to that file that ISN'T "Ran jobs by schedule". If the file is empty, you ran into no errors.
grep's invert-match:
-v, --invert-match Invert the sense of matching, to select non-matching lines.
Coming into this late, I noticed my magento.cron.log file is always empty.
If you remove -v from the command then the file begins to populate with "Ran jobs by schedule" whenever crons are run.
I too believed this should be output by default. The inverse command should be made clear in the Magento documentation.