The cronjobs are defined in the config.xml
files of the Magento modules. Like every configuration in these files, the cronjob configuration is easy to extend in our own module. In this recipe, we will learn how to create extra cronjobs for the Magento installation.
The workflow to execute a cronjob is mostly the same as working with events. We have to configure an observer function in the config.xml
file that will be executed when the cronjob is executed.
In the Packt_Helloworld
module, we will create a cronjob that will save some data in the database.
Follow the ensuing steps to see which configuration is needed to configure an extra cronjob:
We have to create a crontab configuration in the
config.xml
file. The following configuration will do that. Paste this under the<config>
tag of the fileapp/code/local/Packt/Helloworld/etc/config.xml
:<crontab> <jobs> <helloworld_check_subscriptions> <schedule>...