Magento – How safe it is to run the magento cron.php cron job every minute

cronorder-email

About Magento 1.9

I want to run Magento's cron.php every minute because, I want sales email to be sent the soonest possible on client order. So besides the email function can someone let me know what the default cron.php does in the sense how wise it is to run it every minute, and if we do run it every minute what to be aware of before 1 minute becomes a problem for these jobs.

Best Answer

Completely safe - and in most cases mandatory, otherwise jobs can end up being skipped.

Just make sure you are executing cron.sh not cron.php

Just note that the regularity of the cron itself won't dictate when cron operations take place - the module itself does that.

Eg. Using the awesome MageRun to list tasks,

[www-data@acc1 .microcloud ~]
[~]$ mr_examplecom sys:cron:list


  Cronjob List


+-----------------------------------------+------+----+----+----+----+
| Job                                     | m    | h  | D  | M  | WD |
+-----------------------------------------+------+----+----+----+----+
| aggregate_sales_report_bestsellers_data | 0    | 0  | *  | *  | *  |
| aggregate_sales_report_coupons_data     | 0    | 0  | *  | *  | *  |
| aggregate_sales_report_invoiced_data    | 0    | 0  | *  | *  | *  |
| aggregate_sales_report_order_data       | 0    | 0  | *  | *  | *  |
| aggregate_sales_report_refunded_data    | 0    | 0  | *  | *  | *  |
| aggregate_sales_report_shipment_data    | 0    | 0  | *  | *  | *  |
| aggregate_sales_report_tax_data         | 0    | 0  | *  | *  | *  |
| captcha_delete_expired_images           | */10 | *  | *  | *  | *  |
| captcha_delete_old_attempts             | */30 | *  | *  | *  | *  |
| catalog_product_alert                   |      |    |    |    |    |
| catalog_product_index_price_reindex_all | 0    | 2  | *  | *  | *  |
| catalogrule_apply_all                   | 0    | 1  | *  | *  | *  |
| core_clean_cache                        | 30   | 2  | *  | *  | *  |
| currency_rates_update                   |      |    |    |    |    |
| log_clean                               |      |    |    |    |    |
| newsletter_send_all                     | */5  | *  | *  | *  | *  |
| paypal_fetch_settlement_reports         |      |    |    |    |    |
| persistent_clear_expired                | 0    | 0  | *  | *  | *  |
| sales_clean_quotes                      | 0    | 0  | *  | *  | *  |
| sitemap_generate                        |      |    |    |    |    |
| system_backup                           |      |    |    |    |    |
| xmlconnect_notification_send_all        | */5  | *  | *  | *  | *  |
+-----------------------------------------+------+----+----+----+----+

You can see that amongst the tasks, the most regular in this list is every 5 minutes. Which means that even if the cron were to be configured to run every minute, it wouldn't make a difference, as newsletter_send_all and xmlconnect_notification_send_all would only run every 5 minutes.


If CLI isn't your bag, then you can use (the equally awesome) Aoe Scheduler to visualise the timeline.

This will let you see when tasks are due to run, and if they are being executed or skipped.