Reputation: 296
I want to fetch image via openkm server.. so i want to make Observer who run every two min
My config.xml
FlyonitImage/Openkm/etc/config.xml
<events>
<openkm_image_send>
<observers>
<flyonitimage_openkm_model_observer>
<type>singleton</type>
<class>Flyonitimage_Openkm_Model_Observer</class>
<method>sendimageopenkm</method>
</flyonitimage_openkm_model_observer>
</observers>
</openkm_image_send>
</events>
<crontab>
<jobs>
<openkm_image_send>
<schedule><cron_expr>*/2 * * * *</cron_expr></schedule>
<run><model>Flyonitimage_Openkm_Model/observer::sendimageopenkm</model></run>
</openkm_image_send>
</jobs>
</crontab>
and Observer.php
is FlyonitImage/Openkm/Model/Observer.php
<?php
class Flyonitimage_Openkm_Model_Observer
{
public function sendimageopenkm()
{
//this collection get all users which have birthday on today
Mage::log("nice to learn this ");
return $this;
}
}
but its not showing any log.. i will put fetchimage code after making log..
Thanks
Upvotes: 2
Views: 1596
Reputation: 385
The run element should have value like:
<run>
<model>module/model::method</model>
</run>
In your case it should be:
<run>
<model>openkm/observer::sendimageopenkm</model>
</run>
That should work only when you setup entry in crontab for the cron.php file located in the Magento root.
If you want to test before setting cron on OS, then hit magento-root/cron.php in browser. First time hit will create entry in your Magento cron schedule table.
Then after 2 min again hit the same URL. This time your job will be executed.
Thanks
Upvotes: 1
Reputation: 2835
have you setup [magento-root]/cron.php properly? if yes then set cronjob run every 1 minute or you can use 3rd part cronjob services such as:
- https://www.setcronjob.com/
- http://www.easycron.com/
- http://www.webcron.org/
Upvotes: 0
Reputation: 98
call the above sendimageopenkm() function by setting cron as
2 * * * * /usr/bin/wget -q "ur path" (Here wget is internal browser in linux)
Upvotes: 0