<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Magento Expert</title>
	<atom:link href="https://www.the-mage-expert.com/tag/cron-jobs/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.the-mage-expert.com</link>
	<description>Your Magento Commerce Expert</description>
	<lastBuildDate>Thu, 05 Nov 2026 21:47:58 +0000</lastBuildDate>
	<language>de-DE</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.6</generator>
	<item>
		<title>Preventing Parallel Execution of Cron Jobs</title>
		<link>https://www.the-mage-expert.com/3209/preventing-parallel-execution-of-cron-jobs/</link>
		<comments>https://www.the-mage-expert.com/3209/preventing-parallel-execution-of-cron-jobs/#comments</comments>
		<pubDate>Wed, 14 Oct 2026 19:48:15 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[cron-jobs]]></category>
		<category><![CDATA[Magento 2]]></category>
		<category><![CDATA[Parallel Processing]]></category>

		<guid isPermaLink="false">https://www.the-mage-expert.com/?p=3209</guid>
		<description><![CDATA[When a custom Magento cron job runs longer than its configured interval, another execution may start while the previous one is still working. For imports, exports or other write operations, that can lead to duplicate processing or conflicting writes. Magento&#8230;]]></description>
				<content:encoded><![CDATA[<p>When a custom Magento cron job runs longer than its configured interval, another execution may start while the previous one is still working. For imports, exports or other write operations, that can lead to duplicate processing or conflicting writes.</p>
<p>Magento already provides a suitable mechanism through the <strong>LockManagerInterface</strong> . Acquire a lock before starting the main operation. If the lock already exists, the second execution can exit immediately.</p><pre class="crayon-plain-tag">use Magento\Framework\Lock\LockManagerInterface;

class Import
{
    public function __construct(
        private LockManagerInterface $lockManager
    ) {
    }

    public function execute(): void
    {
        $lockName = 'vendor_module_import';

        if (!$this-&gt;lockManager-&gt;lock($lockName, 0)) {
            return;
        }

        try {
            // Run import
        } finally {
            $this-&gt;lockManager-&gt;unlock($lockName);
        }
    }
}</pre><p>The lock name should uniquely identify the process. While <strong>vendor_module_import</strong> is locked, another run with the same lock cannot begin at the same time.</p>
<p>The important part is the <strong>finally</strong>: Even if the cron job throws an exception, the lock is released afterwards.</p>
<p>Magento uses its lock mechanism internally in several places. For longer-running custom cron jobs, <strong>LockManagerInterface</strong> is cleaner and safer than a homemade status file or a flag in the database.</p>]]></content:encoded>
			<wfw:commentRss>https://www.the-mage-expert.com/3209/preventing-parallel-execution-of-cron-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which Module Defines Which Cron Job?</title>
		<link>https://www.the-mage-expert.com/3166/which-module-defines-which-cron-job/</link>
		<comments>https://www.the-mage-expert.com/3166/which-module-defines-which-cron-job/#comments</comments>
		<pubDate>Thu, 08 Oct 2026 20:17:21 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[cron-jobs]]></category>
		<category><![CDATA[Magento 2]]></category>

		<guid isPermaLink="false">https://www.the-mage-expert.com/?p=3166</guid>
		<description><![CDATA[Ever seen an unfamiliar cron job in cron_schedule but could not tell which module owns it from the job_code alone? Magento cron jobs are normally defined in a crontab.xml. A simple code search can reveal the corresponding definition. [crayon-6af34002a1079/] If&#8230;]]></description>
				<content:encoded><![CDATA[<p>Ever seen an unfamiliar cron job in <strong>cron_schedule</strong> but could not tell which module owns it from the <strong>job_code</strong> alone?</p>
<p>Magento cron jobs are normally defined in a <strong>crontab.xml</strong>. A simple code search can reveal the corresponding definition.</p><pre class="crayon-plain-tag">grep -R --include=&quot;crontab.xml&quot; 'job name=&quot;mein_job_code&quot;' app/code vendor</pre><p></p>
<p>If the job is called <strong>vendor_sync_products</strong> , search for its name.</p><pre class="crayon-plain-tag">grep -R --include=&quot;crontab.xml&quot; 'job name=&quot;vendor_sync_products&quot;' app/code vendor</pre><p></p>
<p>The result points directly to the <strong>crontab.xml</strong> and usually the module that defines it. The job definition also specifies the PHP class and method Magento runs.</p>
<p>This is especially useful when a job repeatedly ends with <strong>error</strong> , runs for an unusually long time or fills <strong>cron_schedule</strong> with thousands of entries and you do not yet know which extension is responsible.</p>]]></content:encoded>
			<wfw:commentRss>https://www.the-mage-expert.com/3166/which-module-defines-which-cron-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting running status correctly in Magento 1.4</title>
		<link>https://www.the-mage-expert.com/352/setting-running-status-correctly-magento1-4/</link>
		<comments>https://www.the-mage-expert.com/352/setting-running-status-correctly-magento1-4/#comments</comments>
		<pubDate>Wed, 08 May 2013 10:07:21 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[cron-jobs]]></category>

		<guid isPermaLink="false">https://www.the-mage-expert.com/?p=352</guid>
		<description><![CDATA[The setting of the running status in the cron_schedule table in Magento 1.4 is not working correctly. The code in Magento 1.4 is not 100% correct. Create a local copy of Mage_Cron_Model_Observer and take a look at the dispatch function:&#8230;]]></description>
				<content:encoded><![CDATA[<p>The setting of the running status in the cron_schedule table in Magento 1.4 is not working correctly. The code in Magento 1.4 is not 100% correct. Create a local copy of <em>Mage_Cron_Model_Observer</em> and take a look at the dispatch function:</p>
<p></p><pre class="crayon-plain-tag">$schedule-&gt;setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', time()))-&gt;save();</pre><p></p>
<p>The status should also be saved here, not just the execution time. Change the code from the above to the below:</p>
<p></p><pre class="crayon-plain-tag">$schedule-&gt;setStatus(Mage_Cron_Model_Schedule::STATUS_RUNNING)-&gt;setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', time()))-&gt;save();</pre><p></p>]]></content:encoded>
			<wfw:commentRss>https://www.the-mage-expert.com/352/setting-running-status-correctly-magento1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring and running cron jobs</title>
		<link>https://www.the-mage-expert.com/15/magento-configuring-and-running-cron-jobs/</link>
		<comments>https://www.the-mage-expert.com/15/magento-configuring-and-running-cron-jobs/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 16:29:03 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[cron-jobs]]></category>

		<guid isPermaLink="false">https://www.the-mage-expert.com/?p=15</guid>
		<description><![CDATA[To add and run a Magento cron job in your module, add the following XML to your modules config.xml: [crayon-6af34002a1530/] Thats the first step. Once that was done, you have to manually or automatically run cron.php. Its in your stores&#8230;]]></description>
				<content:encoded><![CDATA[<p>To add and run a Magento cron job in your module, add the following XML to your modules config.xml:</p><pre class="crayon-plain-tag">&lt;config&gt;
    &lt;crontab&gt;
        &lt;jobs&gt;
            &lt;some_unique_job_code&gt;
                &lt;schedule&gt;
                    &lt;!-- every minute for example --&gt;
                    &lt;cron_expr&gt;*/1 * * * *&lt;/cron_expr&gt;
                &lt;/schedule&gt;
                &lt;run&gt;
                    &lt;model&gt;module/observer::functionToRun&lt;/model&gt;
                &lt;/run&gt;
            &lt;/some_unique_job_code&gt;
        &lt;/jobs&gt;
    &lt;/crontab&gt;
&lt;/config&gt;</pre><p></p>
<p>Thats the first step. Once that was done, you have to manually or automatically run <em>cron.php</em>. Its in your stores root directory. After running <em>cron.php</em>, you should see entries mathcing your new job in the <em>cron_schedule</em> table.</p>]]></content:encoded>
			<wfw:commentRss>https://www.the-mage-expert.com/15/magento-configuring-and-running-cron-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
