All posts

Magento cron and indexers: the background jobs checkout relies on

A Magento store does a lot of work when nobody is looking: reindexing, applying scheduled prices, sending order emails, cleaning up abandoned payments. All of it runs from cron. When cron stops, nothing crashes. The store just slowly stops telling the truth.

Free checkout scan

Enter your store address. A real browser adds a product to the cart and walks the checkout up to the payment step, like a customer, and shows you every step with a screenshot.

  • Free, no account
  • Stops before payment, no order
  • Nothing to install
· Updated · 3 min read
A brass gear on a dark table

What cron keeps running

The server’s crontab calls bin/magento cron:run every minute. Magento then picks the jobs that are due from each cron group and records every run in the cron_schedule table. A few of those jobs matter directly to the checkout:

Job or groupWhat it doesWhen it stops
indexer_update_all_viewsApplies catalog, price and stock changes when indexers are on Update by ScheduleCart shows old prices, sold-out products stay buyable
sales_send_order_emailsSends order emails when asynchronous sending is onCustomers get no confirmation and write in
sales_clean_ordersCancels old Pending payment orders and frees their stockStock stays reserved for orders nobody paid
consumers_runnerStarts message queue consumersStock reservations and async work pile up
catalogrule_apply_allApplies catalog price rules on scheduleA promotion never starts or never ends
crontabevery minutebin/magento cron:runlogs to cron_scheduleIndexersprices, stockOrder emailsasync sendingClean ordersold pending paymentConsumersmessage queue
One crontab line runs everything on the right. When it stops, each job falls behind without an error on the storefront.

Why cron stops

Almost always for dull reasons: a server move that forgot the crontab, a crontab that calls a different PHP version than the web server, a job that hangs and keeps its group from running, or a lock left behind after a crash or a full disk. None of them shows an error on the storefront.

The store keeps working

Pages load, products add to the cart and orders go through. That is why a dead cron is usually found days later, through a customer asking where their confirmation email is.

Check it in five minutes

Start with the crontab of the user that owns the Magento files. It should contain the lines bin/magento cron:install writes:

bash
# As the Magento file owner, not root
crontab -l | grep -i magento

# Missing? Install the standard entries
bin/magento cron:install

Then ask the database when jobs last ran and which ones failed. Add your table prefix if the store uses one:

sql
-- Last finished jobs: the newest finished_at should be minutes old
SELECT job_code, status, finished_at
FROM cron_schedule
WHERE status = 'success'
ORDER BY finished_at DESC
LIMIT 10;

-- Recent errors with their messages
SELECT job_code, executed_at, LEFT(messages, 200) AS error
FROM cron_schedule
WHERE status = 'error'
ORDER BY executed_at DESC
LIMIT 10;

Finally run cron by hand with the same PHP the crontab uses. Errors that were going nowhere now print on screen:

bash
php bin/magento cron:run --group=default
php bin/magento indexer:status

Indexers that never catch up

With indexers on Update by Schedule, which Adobe recommends for production, a change in the admin is written to a changelog and applied by cron. If indexer:status shows indexers stuck on Reindex required or Processing for hours, fix cron first, then rebuild:

bash
# Production: let cron apply changes instead of every admin save
bin/magento indexer:set-mode schedule

# Clear a stuck "processing" state, then rebuild
bin/magento indexer:reset catalog_product_price
bin/magento indexer:reindex catalog_product_price
A full reindex on a large catalog takes time and load; run it at a quiet hour.
Fix the cause before the reindex

A manual reindex hides the symptom for a day. If cron is still broken, the indexers fall behind again with the next price change.

Watch the heartbeat

Alert when the newest successful cron job is older than it should be, and when an indexer stays invalid. The free MageSentinel Magento module shows both on its Store health page, checks them every 15 minutes and emails you when one turns red and again when it is fixed.

An end-to-end checkout check covers the result: the cart shows the price you expect and the order goes through. Together you catch the cause and the symptom. Related: message queue consumers and MSI salable quantity. To check the checkout once, right now, run the free Magento checkout test.

Find out your checkout broke before your customers do.

Real checkout checks for Magento and WooCommerce · free plan · no card requiredMagento checkout monitoring →
FAQ

Common questions

Still have a question?More answers, and a way to reach us.Support →
01What happens if Magento cron stops?

Indexers fall behind, so prices and stock go stale; asynchronous order emails queue up; old pending payment orders are not cancelled; and queue consumers started by cron stop. The storefront keeps working, which is why it goes unnoticed.

02How do I check that Magento cron is running?

Check the crontab of the Magento file owner, look at the newest success rows in the cron_schedule table, and run bin/magento cron:run by hand to see errors.

03Should indexers be on Update on Save or Update by Schedule?

Update by Schedule is recommended for production. It depends on cron running, so monitor cron when you use it.