I'm pretty sure my cronjobs doesn't work properly. All catalog rules that I created are resetting every day. I checked the cron_schedule table in my db and its empty. Is there a way to test or check if the jobs are well executed?

According to the Magento 2 documentation, I have created a crontab like the following:

* * * * * /usr/bin/php /var/www/prod/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/prod/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/prod/update/cron.php >> /var/www/prod/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/prod/bin/magento setup:cron:run >> /var/www/prod/var/log/setup.cron.log

When I search for "How to create a cronjob for M2", I find a lot of answers. For example, some adds the php.ini path or */1 for schedule.

*/1 * * * * /usr/bin/php -c /etc/php/7.0/cli/php.ini /var/www/prod/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/prod/var/log/magento.cron.log
*/1 * * * * /usr/bin/php -c /etc/php/7.0/cli/php.ini /var/www/prod/update/cron.php >> /var/www/prod/var/log/update.cron.log
*/1 * * * * /usr/bin/php -c /etc/php/7.0/cli/php.ini /var/www/prod/bin/magento setup:cron:run >> /var/www/prod/var/log/setup.cron.log

Which one should I use?

  • You need to match these settings with settings in your admin configuration. Also 1 minute is not enough to complete the task before the next one begins so it will never finish. 5 minutes at least and i recommend 10 min Oct 31, 2017 at 20:21

1 Answer 1


I am going to explain three different ways to test if your cronjobs are working properly.

First of all

Magento creates three log files, which are var/log/magento.cron.log, var/log/update.cron.log and var/log/setup.cron.log. You can watch these log files.


You should see some input with the following SQL query: select * from cron_schedule. It keeps track of each cron job, when it is run, when it is finished if it is finished.


You can run the following commands on your command line, and see if they are running properly without any error.

/usr/bin/php /var/www/prod/bin/magento cron:run | grep -v "Ran jobs by schedule"
/usr/bin/php /var/www/prod/update/cron.php
/usr/bin/php /var/www/prod/bin/magento setup:cron:run

About the cronjob entries

To your second question (Which one should I use?), the first and the second approach almost the same. The only difference is that you are explicitly defining the php.ini in the second one. In my opinion, the php.ini file for cronjobs and for the web should be the same. (Note that */1 and * is the same thing.)

To avoid issues during installation and upgrade, we strongly recommend you apply the same PHP settings to both the PHP command-line configuration and to the PHP web server plug-in’s configuration. For more information, see Required PHP settings. http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

  • I try this command : /usr/bin/php /var/www/prod/bin/magento cron:run | grep -v "Ran jobs by schedule" and result is : Notice: Undefined index: jobs in /var/www/prod/vendor/magento/module-cron/Model/Config/Converter/Db.php on line 39 Also try : /usr/bin/php /var/www/prod/update/cron.php and result : Cron readiness check failure! Found non-writable paths: /var/www/prod/ISSUE_TEMPLATE.md [] [] in the update.log
    – cap340
    Nov 1, 2017 at 2:34
  • You might wanna look at this question, magento.stackexchange.com/questions/145349/… Nov 1, 2017 at 13:46
  • 1
    thanks, my M2 store come from a M1.7 with migration tools and it seems these tools added entries from M1 in the core_config_data table so the new config as no access to the new db.
    – cap340
    Nov 1, 2017 at 19:08
  • 2
    solved. just run "delete from core_config_data where path like 'crontab/jobs%';" and now my cron_schedule table has entries. Thanks a lot
    – cap340
    Nov 2, 2017 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.