Magento 2 troubleshooting › Indexing and cron
How do I check if Magento cron is running?
Short answer: Look at cron_schedule: if nothing has executed in the last 15 minutes, cron isn't running. If it is, look for jobs with status error, missed, or running for hours.
Magento's cron runs every minute from the server's crontab (bin/magento cron:run). Each run schedules jobs in cron_schedule and records the result. Indexing, order emails, sitemaps, currency rates and clean-ups all depend on it.
Check it step by step
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
1. Did anything run in the last 15 minutes?
Works on Magento Open Source and Adobe Commerce:
SELECT MAX(executed_at) AS last_executed, MAX(finished_at) AS last_finished,
SUM(status = 'pending') AS pending_jobs
FROM cron_schedule;
If last_executed is old, the crontab entry is missing or failing.
2. Errors in the last 24 hours
Works on Magento Open Source and Adobe Commerce:
SELECT job_code, COUNT(*) AS errors, MAX(executed_at) AS last_error, MAX(messages) AS example_message
FROM cron_schedule
WHERE status = 'error'
AND executed_at >= NOW() - INTERVAL 1 DAY
GROUP BY job_code
ORDER BY errors DESC;
3. Jobs stuck in “running”
Works on Magento Open Source and Adobe Commerce:
SELECT job_code, executed_at, TIMESTAMPDIFF(MINUTE, executed_at, NOW()) AS minutes_running
FROM cron_schedule
WHERE status = 'running'
AND executed_at < NOW() - INTERVAL 1 HOUR
ORDER BY executed_at;
4. Last successful run of each job
Works on Magento Open Source and Adobe Commerce:
SELECT job_code, MAX(finished_at) AS last_success
FROM cron_schedule
WHERE status = 'success'
GROUP BY job_code
ORDER BY last_success;
Jobs at the top of this list haven't succeeded for the longest time.
How to fix it
- Check the crontab of the user that owns the Magento files:
crontab -l. It should callbin/magento cron:runevery minute. Install it withbin/magento cron:install. - Run it by hand to see errors:
bin/magento cron:run, then look invar/log/. - missed jobs usually mean cron runs too rarely or a long job blocked the group; check Stores › Configuration › Advanced › System › Cron (Scheduled Tasks).
- A job left in running usually means the process was killed (memory limit, timeout, a deploy or a restart). Find the cause in the logs before you clear it, or it will happen again.
Good to know
- History is cleaned by cron itself (Success History Lifetime, Failure History Lifetime), so an empty table can also mean cron never ran.