I'm trying to set-up a cron job for multiple models. I have two methods (method1 and method2) in Model (observer.php) for which I want to set cron job. My code :
Config.xml file :
<crontab>
<jobs>
<erpbridge_update>
<schedule>
<cron_expr>* * * * *</cron_expr>
</schedule>
<run>
<model>erpbridge/observer::method1</model>
</run>
</erpbridge_update>
<mss_erpbridge>
<schedule>
<cron_expr>* * * * *</cron_expr>
</schedule>
<run>
<model>erpbridge/observer::method2</model>
</run>
</mss_erpbridge>
</jobs>
</crontab>
Name space is Mss and module name is Erpbridge, Cron job with the right module name working perfectly <mss_erpbridge>
but this is not working </erpbridge_update>
. When I set the same key for both <mss_erpbridge>
then only the second works.
My query :
Is it possible to set a cron job for multiple Models if yes, How?
Best Answer
Deepak, may be at any xml file you have using
erpbridge
_update name cronjob.I suggest to you use
any another name for cronjob identofier event name
.As magento save the
cronjob idenfier
in cronjob table at db and basic of this table magento cronjob is excute. So, you cannot use name idenfier name for two cronjob.For example from app/code/core/Mage/CatalogRule/etc/config.xml: