
<?xml version="1.0"?> <config> <modules> <New_Module> <active>true</active> <codePool>local</codePool> </New_Module> </modules> </config>
In app/code/local/New/Module/etc
<?xml version="1.0"?> <config> <modules> <New_Module> <version>0.0.1</version> </New_Module> </modules> <global> <models> <new_module> <class>New_Module_Model</class> </new_module> </models> </global> <crontab> <jobs> <new_module> <schedule><cron_expr>*/1 * * * *</cron_expr></schedule> <run><model>new_module/observer::test</model></run> </new_module> </jobs> </crontab> </config>
Please note that the model tag is the same used in the run/model tag in the crontab job.
For this example, the job will be run every minute.
- Minute: */5
- Hour: *
- Day of the Month: *
- Month: *
- Day of the Week: *
class New_Module_Model_Observer { public function test() { //Do something amazing return $this; } }
THAT’S ALL, NOW TO TEST:
2) Delete everything in the cron_schedule table.
3) Run the following command to schedule all the jobs, you will notice that the cron_schedule table will be filled with some entries, you should also see the entry new_module .
php -q path/to/my/magento/root/cron.php
4) Run it again and your cron job will be executed.
Related Articles

The Importance of Community and Networking: Building Bridges for Success framework
By Luigi Laezza

Embracing a New Paradigm: Developing for the Browser vs. Procedural Code framework
By Luigi Laezza

Refining Our Backend-Powered Modals for Enhanced Transitions and Layouts framework
By Luigi Laezza

Creating Dynamic UIs: Disabling and Enabling Interaction Based on Application States framework
By Luigi Laezza

How AI and Automation Can Transform Your Business framework
By Luigi Laezza

Checkboxes vs. Radio Buttons: Simplifying User Interaction in Web Forms framework
By Luigi Laezza

Enhancing Your Writing Efficiency: Avoiding Verbose Pitfalls framework
By Luigi Laezza

Harnessing Events: The Core of Every Graphical Application framework
By Luigi Laezza