Skip to content

Instantly share code, notes, and snippets.

@ProcessEight
Last active July 19, 2024 09:19
Show Gist options
  • Save ProcessEight/2b8df3290795efaf71a990a56dad449b to your computer and use it in GitHub Desktop.
Save ProcessEight/2b8df3290795efaf71a990a56dad449b to your computer and use it in GitHub Desktop.
Cheatsheet for debugging cron-based issues in Magento 2

Magento Debugging Cheatsheet: Cron Edition

  • Verify the cron is installed properly in the crontab. Run php bin/magento cron:install to install the cron.
  • Verify it is installed for the web server user. Use crontab -l to list the crontab for the current user.
    • The command Magento runs is: /usr/bin/php /var/www/vhosts/magento-project/html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/vhosts/magento-project/html/var/log/magento.cron.log
  • Verify that the line in crontab is not commented out (i.e. Does not start with #).
  • Verify the cron is running properly. Run php bin/magento cron:run to run the cron. This prompts Magento to generate new cron schedules in the cron_schedule table.
  • Verify other cron jobs are running
  • Check cron tables in db for hidden error messages
  • Check cron logs for error messages
  • Schedule a cron task for scheduled execution using magerun. Does the job get added to magento cron db tables?
  • Install a cron management tool in the admin
  • See also: https://support.xtento.com/wiki/Setting_up_the_Magento_cronjob_(Magento_2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment