Magento cron job not working

Magento cron job not working

October 5, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento cron job not working

Solving Magento Cron Job Not Working Issue

Introduction

Are you facing issues with your Magento cron job not working as expected? You’re not alone. In this post, we’ll troubleshoot the common “Magento cron job not working” issue and ensure your scheduled tasks run smoothly.

Understanding Mage::log in Magento

The Mage::log() function is a powerful tool for logging information during development or debugging processes in Magento. It’s used to write messages into log files located under magento/var/log/system.log.

However, there are some key points to keep in mind:

  1. Log File Permissions: Ensure that the web server has write permissions on the system.log file and its directory.

  2. Log Level: The log level must be set correctly for your message to appear. By default, Magento uses CRITICAL, ERROR, WARN, NOTICE, INFO, and DEBUG levels.

  3. Cron Job Configuration: The cron job needs to be configured properly in the system.xml file of your custom module.

Troubleshooting Your Scenario

Let’s analyze the provided code snippet:

config.xml

<crontab>
    <jobs>
        <jr_createadmincontroller>
            <schedule><cron_expr>* * * * *</cron_expr></schedule>
            <run><model>createadmincontroller/observer::setStatus</model></run>
        </jr_createadmincontroller>
    </jobs>
</crontab>

Observer.php

class JR_CreateAdminController_Model_Observer {
    public function setStatus() {
        Mage::log("WORKS!");
    }
}

From the provided code, it seems that you’ve configured the cron job correctly in your config.xml file. The cron expression * * * * * means “run every minute.” Your observer class is also properly set up to use the Mage::log() function.

However, there are a few things we need to verify:

  1. Log File Permissions: Check if the web server has write access to the magento/var/log/system.log file and its directory. If not, grant the necessary permissions using your operating system’s file management tools or commands like chown and chmod.
sudo chown -R www-data:www-data /var/www/html/magento/
sudo chmod 775 -R /var/www/html/magento/var/log
  1. Log Level: Check if your log level is set to a suitable value for debugging purposes. You can modify the log level in magento/app/code/core/Mage/Core/etc/config.xml:
<config>
    <global>
        <log>
            <active>1</active>
            <model> Mage_Core_Model_Log_Adapter_Db </model>
            <destinations>
                <system>
                    <class_name>Mage_Core_Model_Log_Adapter_Db</class_name>
                    <file_name>system.log</file_name>
                    <level>DEBUG</level>
                </system>
            </destinations>
        </log>
    </global>
</config>
  1. Cron Job Configuration: Ensure that your cron job is enabled and running. You can check this by examining the crontab.log file located under magento/var/log/crontab.log.

Checking if Your Cron Job is Running

To verify if your cron job is executing, follow these steps:

  1. Check system.log: Review the contents of magento/var/log/system.log. If you see “WORKS!” written in this file after the cron job runs, it means your observer is firing correctly.

  2. Check crontab.log: The crontab.log file logs information about all executed cron jobs. You can use this log to confirm if your custom cron job ran as expected with the correct interval (every minute in your case).

Conclusion

In most cases, issues with Magento cron jobs not working are related to permissions or configuration problems. Always ensure:

  1. The web server has write access to the system.log file.
  2. Your log level is configured correctly for debugging purposes.
  3. Your cron job is enabled and running according to its schedule.

By following these best practices, you’ll be able to troubleshoot “Magento cron job not working” issues effectively and ensure your scheduled tasks run as intended.

For more in-depth information about Magento development and troubleshooting, consider exploring the expert insights available at Laravel Company.

Security Extensions Admin Configuration

Our network