Is there a problem that needs an urgent fix?Urgent fix?Get emergency help →
Blog

Practical Magento 2 guides on upgrades, security, speed and migration, written by the MageBooster team.

Magento 2 Cron Setup: Install, Check and Fix

Install the Magento cron as the file system owner, check it with crontab -l and the cron_schedule table, and set indexers to Update by Schedule. Plus what stops without cron.
Magento 2 cron setup

In short

Magento needs one crontab entry that calls bin/magento cron:run every minute. Install it with bin/magento cron:install as the file system owner, check it with crontab -l, and confirm in the cron_schedule table that jobs finish with status success. Without cron, emails, indexes and sitemaps stop.

This is part 8 of our Magento installation series. Part 7 was Valkey and Redis configuration for Magento. Cron is the last step of the install shown in the video below.

1. Install the crontab as the file system owner

Adobe says every Magento CLI command must be run by the file system owner, the user that owns the Magento files. Do not use root: each Linux user has its own crontab, so root would get the job and write files the web server cannot change. Switch to the owner, go to the Magento folder and run bin/magento cron:install. It answers Crontab has been generated and saved. If a Magento block already exists, add --force to rewrite it.

2. Check the result with crontab -l

As the same user, crontab -l should show one Magento block like this (your path will differ):

#~ MAGENTO START <hash>
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/magento2/var/log/magento.cron.log
#~ MAGENTO END <hash>

3. Run cron once by hand

Run bin/magento cron:run twice. Adobe explains why: the first run finds the tasks and schedules them, the second run executes the ones that are due. With --group index or --group default you run one group only.

4. Read the cron_schedule table

Every job is written to cron_schedule. Check the latest rows:

SELECT job_code, status, scheduled_at, finished_at, messages
FROM cron_schedule
ORDER BY scheduled_at DESC
LIMIT 20;

Status is one of pending, running, success, missed or error. Many missed rows mean cron does not run every minute. An error row has the reason in the messages column. No new rows at all means the crontab is missing or belongs to another user.

5. Set indexers to Update by Schedule

With cron running, run bin/magento indexer:set-mode schedule and check with bin/magento indexer:show-mode. In the Admin the same setting is under System > Tools > Index Management, action Update by Schedule. Indexes then update in the background through cron instead of on every save.

What stops without cron

FeatureWhat you notice
EmailsOrder confirmations and other emails are not sent
IndexesNew prices and products do not appear; Admin shows Reindex Required
SitemapsScheduled XML sitemaps are not generated
Other jobsCatalog price rules, newsletters, stock alerts, currency rates

Next in the series: 7 common Magento install errors and the fix.

Want us to check your cron and indexers?

We install Magento 2.4.9 with cron, indexers and caches set up, and keep the store running. See our Magento installation and setup, managed Magento hosting and speed optimization, or contact us below.

Sources

Installation guides: Magento 2.4.9 on Ubuntu Mage-OS Hyvä
Spotted a mistake on this page? Tell us and we will fix it right away.

Free Site Audit

Send your store details. We check speed, security and extensions, then reply with three quick wins within 3 working days.

Let's talk

Get a quote

Tell us about your store and we’ll reply within one working day. Prefer to chat? Say hello from WhatsApp

MageBooster Book a UnoPim demo See UnoPim live with products like yours. A new PIM or a move from Akeneo: we reply with a plan, a timeline and a quote.
✓ Official UnoPim partner✓ AI agent set up for your team✓ Connected to Magento
MageBooster Start your Hyvä project From scratch or from your current store. We reply with a project plan, a timeline and a quote.
✓ Design and structure by us✓ Hyvä-optimised server✓ Bonus modules included

MageBooster

Let us get in touch with you

Leave your details and your store address. We look at your store first and contact you within one business day, by phone, WhatsApp or email, whichever you prefer.

Partner with us