15

When running:

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

I get:

[Exception]                                                                  
  Notice: Undefined index: jobs in /home/ubuntu/repo/project/vendor/magento/
               module-cron/Model/Config/Converter/Db.php on line 39  
  • What does cron log says? – Aivis Zvezdovs Nov 11 '16 at 13:52
  • There is an error in update.log: setup-cron.ERROR: Database 'my-db' does not exist or specified database server user does not have privileges to access this database. – stephen Nov 14 '16 at 6:03
  • So issue was that the data migration tool added cron entries at the wrong level: so did delete from core_config_data where path like 'crontab/jobs%'; community.magento.com/t5/Technical-Issues/… – stephen Nov 14 '16 at 6:28
  • Fixed the first issue but now running php /var/www/shootingstuff/update/cron.php gives PHP Warning: require_once(/dir/update/vendor/autoload.php): failed to open stream: No such file or directory in /dir/update/app/bootstrap.php on line 15 PHP Fatal error: require_once(): Failed opening required '/dir/update/vendor/autoload.php' (include_path='.:/usr/share/php') in /dir/update/app/bootstrap.php on line 15 – stephen Nov 14 '16 at 6:34
38

In my case it was caused by some cron jobs migrated from Magento 1, in core_config_data. Magento 2 expects the format to be crontab/{groupname}/jobs/{code}, while the imported ones miss the group name (i.e. default). If that is your case you might want to delete the wrong entries in core_config_data, or update them to map the new cron jobs.

| improve this answer | |
  • 3
    You might need to remove all crontab entries from core_config_data table and then run php bin/magento setup:upgrade. – Ndianabasi Jan 24 '19 at 12:03
  • 1
    bin/magento ca:fl config was enough for me – Shapeshifter Aug 23 '19 at 18:39
  • You're right! It's really there in core_config_data since this site that I'm working was migrated before from M1 to M2.1, Thanks again! – MazeStricks Nov 12 '19 at 3:04
  • 2
    Deleted 202 entries :) DELETE FROM core_config_data WHERE path LIKE 'crontab/%' AND path NOT LIKE 'crontab/default%' AND config_id > 0 I needed last part AND config_id > 0 because of safe mode. – Damodar Bashyal Dec 30 '19 at 1:17
  • 1
    Thanks @DamodarBashyal for sharing query. – chirag dodia Feb 20 at 11:03
4

I have the same error. This is the error when migration from Magento 1 to Magento 2. So I fixed it by remove all rows have "path" start by "crobtab" in table "core_config_data".

Then run this: php bin/magento setup:upgrade

And error fixed. Magento 2 will generate all cronjobs again.

| improve this answer | |
  • thanks it worked for me. – biplab rout Nov 13 '19 at 11:28
3

As rcason said: this issue is due to migration from Magento 1 to Magento 2. After removing from "core _config_data" all the values that starts with crontab/default... (under Config Path) the problem is solved, and M2 cron jobs now run with no issue.

| improve this answer | |
0

Looks like you have the wrong format of cron configuration in database. Try cleanup cron_schedule table and try run cron again.

Also please check cron setting in system configuration.

| improve this answer | |
  • 1
    There is nothing in cron_schedule – stephen Nov 14 '16 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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