cancel
Showing results for 
Search instead for 
Did you mean: 

Cron jobs, what these do and should there be output?

SOLVED

Cron jobs, what these do and should there be output?

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?

3 REPLIES

Re: Cron jobs, what these do and should there be output?

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

If my answer was useful, please give "Kudos" to this post.
If my answer helps you to resolve the problem, click on "Accept as Solution".

Re: Cron jobs, what these do and should there be output?

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"

Re: Cron jobs, what these do and should there be output?

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.