magento set cron job inside custom module 1 comment

This module is created using modulecreator.
I have added functionality fot adding cron to it after every 30 Minutes.
You can use gitk to view what change i have done it.(when i add scource code.. 🙂 i will add it soon)

Now Lets say
HPC = your companyname
Econnector = your modulename

A app/code/local/HPC/Econnector/Model/Observer.php

M app/code/local/HPC/Econnector/etc/config.xml

+    <crontab>
+            <jobs>
+                <send_email_cron_pk> 
+                    <schedule><cron_expr>*/30 * * * *</cron_expr></schedule>
+                    <run><model>econnector/observer::sendEmail</model></run>
+                     </send_email_cron_pk>       
+            </jobs>
+        </crontab>


You can see ‘send_email_cron_pk’ job_code under ‘cron_schedule’ table in magento.
If not then run :


you can see your cron set in ‘cron_schedule’ table.

Check the timezone.

If timezone differs
You can do trial and error set ‘scheduled_at’ column as per your need.

Permanant solution of time zone will be added in next post.
I will add later if you want it.

Share on Facebook

About Pragnesh Karia

Pragnesh Karia, Open Source Enthusiast, Software Professional, Software Developer, Technical Lead ,Magento, Joomla ,Joomla LMS , Moodel LMS ,PHP ,Mysql, Ajax, Javascript, Jquery, Linux, Fan of Open Sources , Annet Technologies , SEO Analyst , Mootools

One thought on “magento set cron job inside custom module