Skip to content

Debugging Crons

Crons can be difficult to debug, even on a standard dedicated server.  Cron tasks on the common Linux server log their execution to a file , typically cron.log in /var/log . On Stratus this activity is not logged directly.  And those logs are typically useless other than to know the task attempted to run. A cron.log file does not tell you if the command ran correctly!

Debugging Magento cron tasks

Magento has its own default cron that runs and executes internal jobs and schedules.  The best way to confirm these are running is using the n98-magerun(2) utility.

To confirm any jobs have ran recently, do the following:

  1. Log into your Stratus environment via SSH
  2. Navigate to your Magento document root.
  3. Run n98-magerun2 sys:cron:history | head -25

    You should see output like this. Change the command to drop the 2 at the end of n98-magerun if you are using Magento 1
    ~/public_html$ n98-magerun2 sys:cron:history | head -25

  Last executed jobs


Times shown in America/Los_Angeles
+-----------------------------------------------+---------+---------------------+
| Job                                           | Status  | Finished            |
+-----------------------------------------------+---------+---------------------+
| consumers_runner                              | success | 2019-03-01 07:54:07 |
| indexer_reindex_all_invalid                   | success | 2019-03-01 07:54:07 |
| indexer_update_all_views                      | success | 2019-03-01 07:54:07 |
| sales_send_order_shipment_emails              | success | 2019-03-01 07:54:06 |
| sales_send_order_creditmemo_emails            | success | 2019-03-01 07:54:06 |
| magento_newrelicreporting_cron                | success | 2019-03-01 07:54:06 |
| bulk_cleanup                                  | success | 2019-03-01 07:54:06 |
| catalog_product_outdated_price_values_cleanup | success | 2019-03-01 07:54:05 |
| catalog_product_frontend_actions_flush        | success | 2019-03-01 07:54:05 |
| outdated_authentication_failures_cleanup      | success | 2019-03-01 07:54:05 |
| sales_grid_order_async_insert                 | success | 2019-03-01 07:54:05 |
| sales_grid_order_invoice_async_insert         | success | 2019-03-01 07:54:05 |
| sales_grid_order_shipment_async_insert        | success | 2019-03-01 07:54:05 |
| sales_grid_order_creditmemo_async_insert      | success | 2019-03-01 07:54:05 |
| sales_send_order_emails                       | success | 2019-03-01 07:54:05 |
| sales_send_order_invoice_emails               | success | 2019-03-01 07:54:05 |

From the times you can see jobs ran recently, that means the crons work! If you see a gap of hours or more, then they are not executing properly.

If you do see a time gap, check:

  • The cron commands and paths listed in the Stratus management panel are correct
  • Check any output if you are directing the cron commands to log to a file

Running a specific Magento cron task

If the cron is running but not completing any schedules. Likely there is a single job failing and stopping the rest.  You can run a single job with n98-magerun(2).

  1. Log into your Stratus environment via SSH
  2. Navigate to your Magento document root.
  3. Run n98-magerun2 sys:cron:run You should see output like this. Change the command to drop the 2 at the end for Magento 1
~/public_html$ n98-magerun2 sys:cron:run


  Cronjob


[1] aggregate_sales_report_bestsellers_data
[2] aggregate_sales_report_coupons_data
[3] aggregate_sales_report_invoiced_data
[4] aggregate_sales_report_order_data
[5] aggregate_sales_report_refunded_data
[6] aggregate_sales_report_shipment_data
[7] aggregate_sales_report_tax_data
[8] amazon_payments_process_queued_refunds
[9] analytics_collect_data
[10] analytics_subscribe
[11] analytics_update
[12] backend_clean_cache
[13] bulk_cleanup
[14] captcha_delete_expired_imag
  1. Enter the job number to run the job.  It will report success/failure or other errors if they occur.