Video Lesson: Create custom cron jobs in Magento

Create custom cron jobs in Magento

This is premium content

Only available to enrolled or University students.
Join today to unlock all lessons in this course.

Create custom cron jobs in Magento

Learn how to create custom cron jobs in Magento using crontab.xml to automate scheduled tasks for your module.

Lesson Content

Magento's cron system lets you schedule tasks to run automatically at specific times. Let's build a custom cron job from scratch.

Create a custom cron job

First, create a crontab.xml file in your module's etc directory:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="vendor_module_your_task" instance="Vendor\Module\Cron\Foo" method="execute">
            <schedule>0 2 * * *</schedule>...

Premium content

Enroll to unlock the full content and all course materials.

👋
Maggie

Log in to start chatting!

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Enroll in this course for AI tutor access.

Comments

Join the discussion!

Comments

Want to comment on this lesson?

Enroll in this course to leave comments.